Machlovi commited on
Commit
e9bab27
·
verified ·
1 Parent(s): 8256398

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
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
- # 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",
 
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",