Zegham commited on
Commit
f93eab1
·
verified ·
1 Parent(s): b9a5f8e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -11,7 +11,7 @@ def predict(image):
11
  # For simplicity, let's assume the model can handle raw image input
12
  # If not, you will need to convert the image to a compatible format (base64 or upload to a server)
13
 
14
- image_bytes = image.read() # Read image as bytes
15
 
16
  # If you need to convert the image to base64 (if model requires it)
17
  import base64
@@ -23,6 +23,7 @@ def predict(image):
23
  return response.json()
24
 
25
  # Create the Gradio interface with an image input
26
- iface = gr.Interface(fn=predict, inputs=gr.Image(type="file"), outputs="json")
27
  iface.launch()
28
 
 
 
11
  # For simplicity, let's assume the model can handle raw image input
12
  # If not, you will need to convert the image to a compatible format (base64 or upload to a server)
13
 
14
+ image_bytes = image.tobytes() # Convert PIL image to bytes (this might require adjustment)
15
 
16
  # If you need to convert the image to base64 (if model requires it)
17
  import base64
 
23
  return response.json()
24
 
25
  # Create the Gradio interface with an image input
26
+ iface = gr.Interface(fn=predict, inputs=gr.Image(type="pil"), outputs="json")
27
  iface.launch()
28
 
29
+