updates
Browse files- main.py +20 -6
- static/index.html +3 -4
- static/style.css +16 -1
main.py
CHANGED
@@ -113,10 +113,22 @@ def verify_image(fileUpload: UploadFile):
|
|
113 |
original_media = original_media_string.split(":", 1)
|
114 |
original_media = original_media[1].strip(" ").strip("'")
|
115 |
|
116 |
-
if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
original_media_extension = file_extension(original_media)
|
118 |
-
logging.warning(original_media_extension)
|
119 |
-
|
120 |
filename = str(uuid.uuid4()) + original_media_extension
|
121 |
|
122 |
response = subprocess.check_output(
|
@@ -127,10 +139,12 @@ def verify_image(fileUpload: UploadFile):
|
|
127 |
]
|
128 |
)
|
129 |
|
130 |
-
|
|
|
|
|
|
|
131 |
|
132 |
-
|
133 |
-
return {"response": fileUpload.filename, "contains_c2pa" : c2pa, "contains_watermark" : watermark, "original_media" : original_media}
|
134 |
|
135 |
|
136 |
|
|
|
113 |
original_media = original_media_string.split(":", 1)
|
114 |
original_media = original_media[1].strip(" ").strip("'")
|
115 |
|
116 |
+
if c2pa == 'true':
|
117 |
+
fileupload_extension = file_extension(fileUpload.filename)
|
118 |
+
filename = str(uuid.uuid4()) + fileupload_extension
|
119 |
+
|
120 |
+
response = subprocess.check_output(
|
121 |
+
[
|
122 |
+
"cp",
|
123 |
+
fileUpload.filename,
|
124 |
+
"static/" + filename,
|
125 |
+
]
|
126 |
+
)
|
127 |
+
|
128 |
+
result_image = fileUpload.filname
|
129 |
+
|
130 |
+
elif original_media != 'n/a':
|
131 |
original_media_extension = file_extension(original_media)
|
|
|
|
|
132 |
filename = str(uuid.uuid4()) + original_media_extension
|
133 |
|
134 |
response = subprocess.check_output(
|
|
|
139 |
]
|
140 |
)
|
141 |
|
142 |
+
result_media = filename
|
143 |
+
else:
|
144 |
+
result_media = 'n/a'
|
145 |
+
|
146 |
|
147 |
+
return {"response": fileUpload.filename, "contains_c2pa" : c2pa, "contains_watermark" : watermark, "result_media" : result_media}
|
|
|
148 |
|
149 |
|
150 |
|
static/index.html
CHANGED
@@ -311,19 +311,18 @@
|
|
311 |
|
312 |
console.log("contains_c2pa", data.contains_c2pa);
|
313 |
console.log("contains_watermark", data.contains_watermark);
|
314 |
-
console.log("
|
315 |
|
316 |
document.getElementById("contentCredentialResults").innerHTML = data.contains_c2pa;
|
317 |
document.getElementById("digitalWatermarkResults").innerHTML = data.contains_watermark;
|
318 |
|
319 |
-
console.log("setting flex", uploadedImageContainer);
|
320 |
uploadedImageContainer.style.display = "flex";
|
321 |
document.getElementById('resultLabel').style.display = "block";
|
322 |
|
323 |
document.querySelector('.display-verify .spinner').style.display = "none";
|
324 |
|
325 |
-
if (data.
|
326 |
-
const path = "/" + data.
|
327 |
|
328 |
var truepicDisplay = document.createElement("truepic-display");
|
329 |
|
|
|
311 |
|
312 |
console.log("contains_c2pa", data.contains_c2pa);
|
313 |
console.log("contains_watermark", data.contains_watermark);
|
314 |
+
console.log("result_media", data.result_media);
|
315 |
|
316 |
document.getElementById("contentCredentialResults").innerHTML = data.contains_c2pa;
|
317 |
document.getElementById("digitalWatermarkResults").innerHTML = data.contains_watermark;
|
318 |
|
|
|
319 |
uploadedImageContainer.style.display = "flex";
|
320 |
document.getElementById('resultLabel').style.display = "block";
|
321 |
|
322 |
document.querySelector('.display-verify .spinner').style.display = "none";
|
323 |
|
324 |
+
if (data.result_media != 'n/a') {
|
325 |
+
const path = "/" + data.result_media;
|
326 |
|
327 |
var truepicDisplay = document.createElement("truepic-display");
|
328 |
|
static/style.css
CHANGED
@@ -1,3 +1,7 @@
|
|
|
|
|
|
|
|
|
|
1 |
@import url("https://fonts.cdnfonts.com/css/inter");
|
2 |
|
3 |
body {
|
@@ -39,7 +43,7 @@ p {
|
|
39 |
}
|
40 |
|
41 |
.tabs div.active {
|
42 |
-
border-bottom: 3px solid
|
43 |
}
|
44 |
|
45 |
.right-column {
|
@@ -125,4 +129,15 @@ img.thumbnail {
|
|
125 |
|
126 |
.action-menu button, .action-menu a.btn {
|
127 |
width: 175px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
}
|
|
|
1 |
+
:root {
|
2 |
+
--primary-color: rgba(26, 109, 255, 1);
|
3 |
+
}
|
4 |
+
|
5 |
@import url("https://fonts.cdnfonts.com/css/inter");
|
6 |
|
7 |
body {
|
|
|
43 |
}
|
44 |
|
45 |
.tabs div.active {
|
46 |
+
border-bottom: 3px solid var(--primary-color);
|
47 |
}
|
48 |
|
49 |
.right-column {
|
|
|
129 |
|
130 |
.action-menu button, .action-menu a.btn {
|
131 |
width: 175px;
|
132 |
+
}
|
133 |
+
|
134 |
+
.action-menu .btn {
|
135 |
+
border-radius: 0;
|
136 |
+
color: var(--primary-color);
|
137 |
+
border-color: var(--primary-color);
|
138 |
+
}
|
139 |
+
|
140 |
+
.action-menu .btn:hover {
|
141 |
+
background-color: transparent;
|
142 |
+
color: var(--primary-color);
|
143 |
}
|