Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -29,14 +29,14 @@ def predict_pokemon(image):
|
|
| 29 |
|
| 30 |
return probabilities_dict
|
| 31 |
|
| 32 |
-
# Streamlit interface
|
| 33 |
-
st.title("Pokemon Classifier")
|
| 34 |
-
st.write("A simple MLP classification model for image classification using a pretrained model.")
|
| 35 |
|
| 36 |
-
# Upload image
|
| 37 |
-
uploaded_image = st.file_uploader("Choose an image...", type=["jpg", "png"])
|
| 38 |
|
| 39 |
-
if uploaded_image is not None:
|
| 40 |
image = Image.open(uploaded_image)
|
| 41 |
st.image(image, caption='Uploaded Image.', use_column_width=True)
|
| 42 |
st.write("")
|
|
@@ -50,8 +50,8 @@ if uploaded_image is not None:
|
|
| 50 |
st.dataframe(df)
|
| 51 |
|
| 52 |
# Display predictions as a pie chart
|
| 53 |
-
st.write("### Prediction Chart")
|
| 54 |
-
fig, ax = plt.subplots()
|
| 55 |
-
ax.pie(df["Probability"], labels=df["Pokemon"], autopct='%1.1f%%', colors=plt.cm.Paired.colors)
|
| 56 |
-
ax.set_title('Prediction Probabilities')
|
| 57 |
-
st.pyplot(fig)
|
|
|
|
| 29 |
|
| 30 |
return probabilities_dict
|
| 31 |
|
| 32 |
+
# Streamlit interface
|
| 33 |
+
st.title("Pokemon Classifier")
|
| 34 |
+
st.write("A simple MLP classification model for image classification using a pretrained model.")
|
| 35 |
|
| 36 |
+
# Upload image
|
| 37 |
+
uploaded_image = st.file_uploader("Choose an image...", type=["jpg", "png"])
|
| 38 |
|
| 39 |
+
if uploaded_image is not None:
|
| 40 |
image = Image.open(uploaded_image)
|
| 41 |
st.image(image, caption='Uploaded Image.', use_column_width=True)
|
| 42 |
st.write("")
|
|
|
|
| 50 |
st.dataframe(df)
|
| 51 |
|
| 52 |
# Display predictions as a pie chart
|
| 53 |
+
st.write("### Prediction Chart")
|
| 54 |
+
fig, ax = plt.subplots()
|
| 55 |
+
ax.pie(df["Probability"], labels=df["Pokemon"], autopct='%1.1f%%', colors=plt.cm.Paired.colors)
|
| 56 |
+
ax.set_title('Prediction Probabilities')
|
| 57 |
+
st.pyplot(fig)
|