Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -103,3 +103,16 @@ def predict(data):
|
|
| 103 |
print(f"Error processing image: {e}")
|
| 104 |
return json.dumps({"error": f"Error processing image: {e}"})
|
| 105 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
print(f"Error processing image: {e}")
|
| 104 |
return json.dumps({"error": f"Error processing image: {e}"})
|
| 105 |
|
| 106 |
+
# Create the Gradio interface
|
| 107 |
+
iface = gr.Interface(
|
| 108 |
+
fn=predict,
|
| 109 |
+
inputs=gr.JSON(label="Input JSON"),
|
| 110 |
+
outputs=gr.Textbox(label="Prediction Result"),
|
| 111 |
+
live=True,
|
| 112 |
+
title="Maize Anomaly Detection",
|
| 113 |
+
description="Upload an image of maize to detect anomalies like disease or pest infestation. You can provide local paths, URLs, or base64-encoded images."
|
| 114 |
+
)
|
| 115 |
+
|
| 116 |
+
# Launch the Gradio interface
|
| 117 |
+
iface.launch(share=True, show_error=True)
|
| 118 |
+
|