Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -49,16 +49,15 @@ def predict(image):
|
|
49 |
else:
|
50 |
return "Unexpected class prediction."
|
51 |
|
52 |
-
# Create the Gradio interface
|
53 |
iface = gr.Interface(
|
54 |
fn=predict, # Prediction function
|
55 |
inputs=gr.Image(type="pil"), # Image input (PIL format)
|
56 |
outputs=gr.Textbox(), # Text output (Predicted class description)
|
57 |
live=True, # Update predictions as the user uploads an image
|
58 |
title="Maize Anomaly Detection",
|
59 |
-
description="Upload an image of maize to detect anomalies like disease or pest infestation."
|
60 |
-
api=True # Expose the Gradio interface for API calls (POST requests)
|
61 |
)
|
62 |
|
63 |
-
#
|
64 |
-
iface.launch()
|
|
|
49 |
else:
|
50 |
return "Unexpected class prediction."
|
51 |
|
52 |
+
# Create the Gradio interface
|
53 |
iface = gr.Interface(
|
54 |
fn=predict, # Prediction function
|
55 |
inputs=gr.Image(type="pil"), # Image input (PIL format)
|
56 |
outputs=gr.Textbox(), # Text output (Predicted class description)
|
57 |
live=True, # Update predictions as the user uploads an image
|
58 |
title="Maize Anomaly Detection",
|
59 |
+
description="Upload an image of maize to detect anomalies like disease or pest infestation."
|
|
|
60 |
)
|
61 |
|
62 |
+
# Expose Gradio interface as API endpoint
|
63 |
+
iface.launch(share=True, server_name="0.0.0.0", server_port=7860)
|