Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -17,24 +17,17 @@ def classify_image(input_image):
|
|
| 17 |
|
| 18 |
# Assuming your model outputs probabilities for two classes, you can return the class with the highest probability
|
| 19 |
class_index = np.argmax(prediction)
|
| 20 |
-
class_labels = ["
|
| 21 |
predicted_class = class_labels[class_index]
|
| 22 |
|
| 23 |
return predicted_class
|
| 24 |
|
| 25 |
# Create a Gradio interface
|
| 26 |
-
input_interface = gr.
|
| 27 |
-
output_interface = gr.outputs.Text() # Gradio output component for text
|
| 28 |
-
|
| 29 |
-
# Create the Gradio app
|
| 30 |
-
app = gr.Interface(
|
| 31 |
fn=classify_image,
|
| 32 |
-
inputs=
|
| 33 |
-
outputs=
|
| 34 |
-
live=True,
|
| 35 |
-
title="Image Classifier",
|
| 36 |
-
description="Classify images using a trained model."
|
| 37 |
)
|
| 38 |
|
| 39 |
-
#
|
| 40 |
-
|
|
|
|
| 17 |
|
| 18 |
# Assuming your model outputs probabilities for two classes, you can return the class with the highest probability
|
| 19 |
class_index = np.argmax(prediction)
|
| 20 |
+
class_labels = ["Normal", "Cataract"] # Replace with your actual class labels
|
| 21 |
predicted_class = class_labels[class_index]
|
| 22 |
|
| 23 |
return predicted_class
|
| 24 |
|
| 25 |
# Create a Gradio interface
|
| 26 |
+
input_interface = gr.Interface(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
fn=classify_image,
|
| 28 |
+
inputs="image", # Specify input type as "image"
|
| 29 |
+
outputs="text" # Specify output type as "text"
|
|
|
|
|
|
|
|
|
|
| 30 |
)
|
| 31 |
|
| 32 |
+
# Launch the Gradio app
|
| 33 |
+
input_interface.launch()
|