Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -54,18 +54,18 @@ def predict_image(input_image):
|
|
| 54 |
class_names = ["Normal", "Cataract"]
|
| 55 |
probabilities = prediction[0]
|
| 56 |
|
| 57 |
-
#
|
| 58 |
-
|
| 59 |
for class_name, probability in zip(class_names, probabilities):
|
| 60 |
-
|
| 61 |
|
| 62 |
-
return
|
| 63 |
|
| 64 |
# Crie uma interface Gradio para fazer previsões
|
| 65 |
iface = gr.Interface(
|
| 66 |
fn=predict_image,
|
| 67 |
inputs="image",
|
| 68 |
-
outputs="
|
| 69 |
interpretation="default"
|
| 70 |
)
|
| 71 |
|
|
|
|
| 54 |
class_names = ["Normal", "Cataract"]
|
| 55 |
probabilities = prediction[0]
|
| 56 |
|
| 57 |
+
# Use o Gradio para criar um gráfico de barras horizontais
|
| 58 |
+
bars = []
|
| 59 |
for class_name, probability in zip(class_names, probabilities):
|
| 60 |
+
bars.append(gr.predict.Bar(label=class_name, confidence=probability))
|
| 61 |
|
| 62 |
+
return bars
|
| 63 |
|
| 64 |
# Crie uma interface Gradio para fazer previsões
|
| 65 |
iface = gr.Interface(
|
| 66 |
fn=predict_image,
|
| 67 |
inputs="image",
|
| 68 |
+
outputs=gr.outputs.Image(label="Predictions"),
|
| 69 |
interpretation="default"
|
| 70 |
)
|
| 71 |
|