Update main.py
Browse files
main.py
CHANGED
@@ -6,7 +6,7 @@ import subprocess
|
|
6 |
import os
|
7 |
import json
|
8 |
import uuid
|
9 |
-
import
|
10 |
|
11 |
import torch
|
12 |
from diffusers import (
|
@@ -26,6 +26,9 @@ def file_extension(filename):
|
|
26 |
def generate_image(prompt, model):
|
27 |
torch.cuda.empty_cache()
|
28 |
|
|
|
|
|
|
|
29 |
modelArray = model.split(",")
|
30 |
modelName = modelArray[0]
|
31 |
modelVersion = modelArray[1]
|
@@ -79,9 +82,6 @@ def generate_image(prompt, model):
|
|
79 |
|
80 |
@app.post("/verify")
|
81 |
def verify_image(fileUpload: UploadFile):
|
82 |
-
logging.warning("in verify")
|
83 |
-
logging.warning(fileUpload.filename)
|
84 |
-
|
85 |
# check if the file has been uploaded
|
86 |
if fileUpload.filename:
|
87 |
fileupload_extension = file_extension(fileUpload.filename)
|
@@ -102,9 +102,7 @@ def verify_image(fileUpload: UploadFile):
|
|
102 |
output_filename
|
103 |
]
|
104 |
)
|
105 |
-
|
106 |
-
|
107 |
-
logging.warning(response)
|
108 |
response_list = response.splitlines()
|
109 |
|
110 |
c2pa_string = str(response_list[0])
|
|
|
6 |
import os
|
7 |
import json
|
8 |
import uuid
|
9 |
+
import html
|
10 |
|
11 |
import torch
|
12 |
from diffusers import (
|
|
|
26 |
def generate_image(prompt, model):
|
27 |
torch.cuda.empty_cache()
|
28 |
|
29 |
+
prompt = html.escape(prompt)
|
30 |
+
model = html.escape(model)
|
31 |
+
|
32 |
modelArray = model.split(",")
|
33 |
modelName = modelArray[0]
|
34 |
modelVersion = modelArray[1]
|
|
|
82 |
|
83 |
@app.post("/verify")
|
84 |
def verify_image(fileUpload: UploadFile):
|
|
|
|
|
|
|
85 |
# check if the file has been uploaded
|
86 |
if fileUpload.filename:
|
87 |
fileupload_extension = file_extension(fileUpload.filename)
|
|
|
102 |
output_filename
|
103 |
]
|
104 |
)
|
105 |
+
|
|
|
|
|
106 |
response_list = response.splitlines()
|
107 |
|
108 |
c2pa_string = str(response_list[0])
|