updates
Browse files- main.py +12 -10
- static/images/wave_icon.svg +8 -1
- static/index.html +3 -0
main.py
CHANGED
@@ -19,7 +19,7 @@ app = FastAPI()
|
|
19 |
|
20 |
def file_extension(filename):
|
21 |
filename_list = filename.split(".")
|
22 |
-
return filename_list[1]
|
23 |
|
24 |
|
25 |
@app.get("/generate")
|
@@ -84,20 +84,22 @@ def verify_image(fileUpload: UploadFile):
|
|
84 |
|
85 |
# check if the file has been uploaded
|
86 |
if fileUpload.filename:
|
|
|
|
|
|
|
|
|
87 |
# strip the leading path from the file name
|
88 |
-
fn = os.path.basename(
|
89 |
|
90 |
# open read and write the file into the server
|
91 |
open(fn, "wb").write(fileUpload.file.read())
|
92 |
|
93 |
-
|
94 |
-
filename = str(uuid.uuid4()) + "." + fileupload_extension
|
95 |
-
|
96 |
response = subprocess.check_output(
|
97 |
[
|
98 |
"./scripts/verify.sh",
|
99 |
-
|
100 |
-
|
101 |
]
|
102 |
)
|
103 |
|
@@ -121,12 +123,12 @@ def verify_image(fileUpload: UploadFile):
|
|
121 |
response = subprocess.check_output(
|
122 |
[
|
123 |
"cp",
|
124 |
-
|
125 |
-
"static/" +
|
126 |
]
|
127 |
)
|
128 |
|
129 |
-
result_media =
|
130 |
|
131 |
elif original_media != 'n/a':
|
132 |
original_media_extension = file_extension(original_media)
|
|
|
19 |
|
20 |
def file_extension(filename):
|
21 |
filename_list = filename.split(".")
|
22 |
+
return filename_list[1].lower()
|
23 |
|
24 |
|
25 |
@app.get("/generate")
|
|
|
84 |
|
85 |
# check if the file has been uploaded
|
86 |
if fileUpload.filename:
|
87 |
+
fileupload_extension = file_extension(fileUpload.filename)
|
88 |
+
input_filename = str(uuid.uuid4()) + "." + fileupload_extension
|
89 |
+
output_filename = str(uuid.uuid4()) + "." + fileupload_extension
|
90 |
+
|
91 |
# strip the leading path from the file name
|
92 |
+
fn = os.path.basename(input_filename)
|
93 |
|
94 |
# open read and write the file into the server
|
95 |
open(fn, "wb").write(fileUpload.file.read())
|
96 |
|
97 |
+
|
|
|
|
|
98 |
response = subprocess.check_output(
|
99 |
[
|
100 |
"./scripts/verify.sh",
|
101 |
+
input_filename,
|
102 |
+
output_filename
|
103 |
]
|
104 |
)
|
105 |
|
|
|
123 |
response = subprocess.check_output(
|
124 |
[
|
125 |
"cp",
|
126 |
+
input_filename,
|
127 |
+
"static/" + output_filename,
|
128 |
]
|
129 |
)
|
130 |
|
131 |
+
result_media = output_filename
|
132 |
|
133 |
elif original_media != 'n/a':
|
134 |
original_media_extension = file_extension(original_media)
|
static/images/wave_icon.svg
CHANGED
static/index.html
CHANGED
@@ -524,6 +524,9 @@
|
|
524 |
.then((data) => {
|
525 |
console.log(data);
|
526 |
|
|
|
|
|
|
|
527 |
if (data.contains_c2pa == "true") {
|
528 |
contentCredentialsIcon.setAttribute("class", "check-icon");
|
529 |
} else {
|
|
|
524 |
.then((data) => {
|
525 |
console.log(data);
|
526 |
|
527 |
+
fileUpload.value = "";
|
528 |
+
setVerifyButtonStatus();
|
529 |
+
|
530 |
if (data.contains_c2pa == "true") {
|
531 |
contentCredentialsIcon.setAttribute("class", "check-icon");
|
532 |
} else {
|