Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -79,21 +79,16 @@ def predict(input_img):
|
|
79 |
def create_bar_plot(predictions):
|
80 |
data = pd.DataFrame(list(predictions.items()), columns=["Location", "Probability"])
|
81 |
max_prob = data["Probability"].max()
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
buf = io.BytesIO()
|
93 |
-
plt.savefig(buf, format='png')
|
94 |
-
buf.seek(0)
|
95 |
-
|
96 |
-
return buf
|
97 |
|
98 |
def predict_and_plot(input_img):
|
99 |
predictions = predict(input_img)
|
|
|
79 |
def create_bar_plot(predictions):
|
80 |
data = pd.DataFrame(list(predictions.items()), columns=["Location", "Probability"])
|
81 |
max_prob = data["Probability"].max()
|
82 |
+
return gr.BarPlot(
|
83 |
+
data,
|
84 |
+
x="Location",
|
85 |
+
y="Probability",
|
86 |
+
title="Top 10 Predictions with Probabilities",
|
87 |
+
tooltip=["Location", "Probability"],
|
88 |
+
y_lim=[0, max_prob],
|
89 |
+
width=350, # Set the width of the plot
|
90 |
+
height=600 # Set the height of the plot
|
91 |
+
)
|
|
|
|
|
|
|
|
|
|
|
92 |
|
93 |
def predict_and_plot(input_img):
|
94 |
predictions = predict(input_img)
|