jclyo1 commited on
Commit
d3036fa
1 Parent(s): 60b70ab
Files changed (2) hide show
  1. main.py +22 -1
  2. static/index.html +1 -1
main.py CHANGED
@@ -59,6 +59,14 @@ def generate_image(prompt, model):
59
  ]
60
  )
61
 
 
 
 
 
 
 
 
 
62
  return {"response": filename}
63
 
64
 
@@ -67,6 +75,7 @@ def verify_image(fileUpload: UploadFile):
67
  logging.warning("in verify")
68
  logging.warning(fileUpload.filename)
69
 
 
70
  # check if the file has been uploaded
71
  if fileUpload.filename:
72
  # strip the leading path from the file name
@@ -82,9 +91,21 @@ def verify_image(fileUpload: UploadFile):
82
  ]
83
  )
84
 
 
85
  logging.warning(response)
 
 
 
 
 
 
 
 
 
 
 
 
86
 
87
- return {"response": fileUpload.filename}
88
 
89
 
90
  app.mount("/", StaticFiles(directory="static", html=True), name="static")
 
59
  ]
60
  )
61
 
62
+ subprocess.check_output(
63
+ [
64
+ "cp",
65
+ "output.jpg"
66
+ "static/" + filename,
67
+ ]
68
+ )
69
+
70
  return {"response": filename}
71
 
72
 
 
75
  logging.warning("in verify")
76
  logging.warning(fileUpload.filename)
77
 
78
+
79
  # check if the file has been uploaded
80
  if fileUpload.filename:
81
  # strip the leading path from the file name
 
91
  ]
92
  )
93
 
94
+
95
  logging.warning(response)
96
+ response_list = response.splitlines()
97
+
98
+ c2pa_string = str(response_list[0])
99
+ c2pa = c2pa_string.split(":", 1)
100
+
101
+ watermark_string = str(response_list[1])
102
+ watermark = watermark_string.split(":", 1)
103
+
104
+ original_media_string = str(response_list[2])
105
+ original_media = original_media_string.split(":", 1)
106
+
107
+ return {"response": fileUpload.filename, "contains_c2pa" : c2pa[1], "contains_watermark" : watermark[1], "original_media" : original_media[1]}
108
 
 
109
 
110
 
111
  app.mount("/", StaticFiles(directory="static", html=True), name="static")
static/index.html CHANGED
@@ -142,7 +142,7 @@
142
  <div class="form-group mb-3">
143
  <label>Upload image</label>
144
  <div class="custom-select">
145
- <input type="file" class="form-control" />
146
  </div>
147
  </div>
148
 
 
142
  <div class="form-group mb-3">
143
  <label>Upload image</label>
144
  <div class="custom-select">
145
+ <input type="file" class="form-control" name="fileUpload" id="fileUpload" />
146
  </div>
147
  </div>
148