jays009 commited on
Commit
fb31436
·
verified ·
1 Parent(s): 2b3983d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -49,16 +49,15 @@ def predict(image):
49
  else:
50
  return "Unexpected class prediction."
51
 
52
- # Create the Gradio interface and expose it as an API
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
- # Launch the Gradio interface
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)