daily pastebin goal
31%
SHARE
TWEET

Untitled

a guest Dec 24th, 2017 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import os
  2.  
  3. report_file = open('report.html','w')
  4. table_string = """
  5. <!DOCTYPE html>
  6. <html>
  7. <head>
  8. <style>
  9. table {
  10.    font-family: arial, sans-serif;
  11.    border-collapse: collapse;
  12.    width: 100%;
  13. }
  14.  
  15. td, th {
  16.    border: 1px solid #dddddd;
  17.    text-align: left;
  18.    padding: 8px;
  19. }
  20.  
  21. tr:nth-child(even) {
  22.    background-color: #dddddd;
  23. }
  24. </style>
  25. </head>
  26. <body>
  27. """
  28.  
  29.  
  30. report_file.write(table_string)
  31. report_file.write('<h1>Facial Recognition Report</h1></br>')
  32.  
  33. report_file.write('<table><tr><th>File 1</th><th>File 2</th><th>Score</th></tr>')
  34.  
  35. f = open('./output/log.txt')
  36. for line in iter(f):
  37.     ###Determine if score is under 1.0
  38.     lineSplitScore1 = line.split('representations: ')
  39.     scoreFloat = float(lineSplitScore1[1])
  40.     if scoreFloat <= 1.00 :
  41.         #print line
  42.         print "Score: " + str(scoreFloat)
  43.         file1Split = line.split('File1:')[1].split('File2:')[0]
  44.         print "File1: " + file1Split
  45.         picture1Name = file1Split.replace('/host/./','')
  46.         file2Split = line.split('File2:')[1].split('__Squared__')[0]
  47.         print "File2: " + file2Split
  48.         picture2Name = file2Split.replace('/host/./','')
  49.         report_file.write('<tr><td>' + file1Split.replace('/host/./','') + '</td><td>' + file2Split.replace('/host/./','') + '</td><td>' + str(scoreFloat) + '</td></tr>')
  50.         report_file.write('<tr><td><img src="' + picture1Name + '" alt="image1"></td><td><img src="' + picture2Name + '" alt="image2"></td></tr>')
  51.         print ""
  52.     else:
  53.         pass
  54.        
  55. f.close()
  56. report_file.write('</table></body></html>')
  57. report_file.close
RAW Paste Data
Top