Spaces:
Runtime error
Runtime error
Commit
•
3d2f114
1
Parent(s):
7f4e0b5
Update app.py
Browse files
app.py
CHANGED
@@ -47,6 +47,7 @@ def classify_image(pil_image):
|
|
47 |
plt.ylabel('Probability')
|
48 |
plt.title('Prediction Probabilities')
|
49 |
plt.savefig('prediction_plot.png')
|
|
|
50 |
|
51 |
|
52 |
output_text = f"Predicted Class: {predicted_class_name}, Confidence: {confidence:.4f}\n"
|
@@ -56,7 +57,16 @@ def classify_image(pil_image):
|
|
56 |
return output_text, 'prediction_plot.png'
|
57 |
|
58 |
|
59 |
-
iface = gr.Interface(fn=classify_image,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
|
61 |
|
62 |
iface.launch()
|
|
|
47 |
plt.ylabel('Probability')
|
48 |
plt.title('Prediction Probabilities')
|
49 |
plt.savefig('prediction_plot.png')
|
50 |
+
plt.close()
|
51 |
|
52 |
|
53 |
output_text = f"Predicted Class: {predicted_class_name}, Confidence: {confidence:.4f}\n"
|
|
|
57 |
return output_text, 'prediction_plot.png'
|
58 |
|
59 |
|
60 |
+
iface = gr.Interface(fn=classify_image,
|
61 |
+
inputs="image",
|
62 |
+
outputs=["text", "image"],
|
63 |
+
examples=[
|
64 |
+
"L9_1b95a3808073c0edad3454d1dedf3dcc.jpg",
|
65 |
+
"L6_0a171beb21a6f4d6fef31f8ccb400eae.jpg",
|
66 |
+
"L2_00a6b5e9806a8b072b98fdeacb3f45b5.jpg",
|
67 |
+
"L4_0b02898e9d31954dd5378e0ffbdb9a41.jpg"
|
68 |
+
],
|
69 |
+
live=True)
|
70 |
|
71 |
|
72 |
iface.launch()
|