Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -23,16 +23,16 @@ def check_safety(input_text, uploaded_image):
|
|
23 |
|
24 |
if input_text.strip():
|
25 |
payload["inputs"] = input_text
|
26 |
-
if uploaded_image is not None:
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
|
35 |
-
|
36 |
|
37 |
headers = {
|
38 |
"Content-Type": "application/json",
|
|
|
23 |
|
24 |
if input_text.strip():
|
25 |
payload["inputs"] = input_text
|
26 |
+
# if uploaded_image is not None:
|
27 |
+
# # In Gradio, uploaded_image will be a local temp file path
|
28 |
+
# # Your endpoint expects a URL or base64. Here, we send as base64.
|
29 |
+
# import base64
|
30 |
|
31 |
+
# with open(uploaded_image, "rb") as img_file:
|
32 |
+
# img_bytes = img_file.read()
|
33 |
+
# img_base64 = base64.b64encode(img_bytes).decode('utf-8')
|
34 |
|
35 |
+
# payload["image"] = img_base64 # Assume your backend can accept image this way
|
36 |
|
37 |
headers = {
|
38 |
"Content-Type": "application/json",
|