Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -48,7 +48,11 @@ transform = transforms.Compose([
|
|
48 |
|
49 |
def predict(data):
|
50 |
try:
|
51 |
-
|
|
|
|
|
|
|
|
|
52 |
if not image_input:
|
53 |
return json.dumps({"error": "No image provided."})
|
54 |
|
@@ -109,3 +113,4 @@ iface = gr.Interface(
|
|
109 |
|
110 |
# Launch the Gradio interface
|
111 |
iface.launch(share=True, show_error=True)
|
|
|
|
48 |
|
49 |
def predict(data):
|
50 |
try:
|
51 |
+
# Expecting data to be a list
|
52 |
+
if not isinstance(data, list) or len(data) == 0:
|
53 |
+
return json.dumps({"error": "Input data should be a non-empty list."})
|
54 |
+
|
55 |
+
image_input = data[0].get('image', None)
|
56 |
if not image_input:
|
57 |
return json.dumps({"error": "No image provided."})
|
58 |
|
|
|
113 |
|
114 |
# Launch the Gradio interface
|
115 |
iface.launch(share=True, show_error=True)
|
116 |
+
|