Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -55,7 +55,19 @@ def predict_image(input_image):
|
|
55 |
predicted_class = class_names[np.argmax(prediction)]
|
56 |
probability = prediction[0][np.argmax(prediction)]
|
57 |
|
58 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
return formatted_text
|
60 |
|
61 |
# Crie uma interface Gradio para fazer previsões
|
@@ -63,7 +75,7 @@ iface = gr.Interface(
|
|
63 |
fn=predict_image,
|
64 |
inputs=gr.inputs.Image(label="Upload an Image", type="pil"),
|
65 |
outputs=gr.outputs.Textbox(label="Prediction", type="text"),
|
66 |
-
interpretation="
|
67 |
)
|
68 |
|
69 |
# Execute a interface Gradio
|
|
|
55 |
predicted_class = class_names[np.argmax(prediction)]
|
56 |
probability = prediction[0][np.argmax(prediction)]
|
57 |
|
58 |
+
# Altere a interpretação dos resultados para uma tabela HTML
|
59 |
+
formatted_text = f"""
|
60 |
+
<table>
|
61 |
+
<tr>
|
62 |
+
<th>Predicted Class</th>
|
63 |
+
<th>Probability</th>
|
64 |
+
</tr>
|
65 |
+
<tr>
|
66 |
+
<td>{predicted_class}</td>
|
67 |
+
<td>{probability:.2%}</td>
|
68 |
+
</tr>
|
69 |
+
</table>
|
70 |
+
"""
|
71 |
return formatted_text
|
72 |
|
73 |
# Crie uma interface Gradio para fazer previsões
|
|
|
75 |
fn=predict_image,
|
76 |
inputs=gr.inputs.Image(label="Upload an Image", type="pil"),
|
77 |
outputs=gr.outputs.Textbox(label="Prediction", type="text"),
|
78 |
+
interpretation="html"
|
79 |
)
|
80 |
|
81 |
# Execute a interface Gradio
|