Spaces:
Sleeping
Sleeping
storesource
commited on
Commit
•
9645511
1
Parent(s):
32e791c
Update app.py
Browse files
app.py
CHANGED
@@ -46,20 +46,21 @@ canvas_result = st_canvas(
|
|
46 |
stroke_width=3,
|
47 |
stroke_color="rgba(0, 0, 0, 1)",
|
48 |
background_color="rgba(255, 255, 255, 1)",
|
49 |
-
height=
|
50 |
-
width=
|
51 |
update_streamlit=True,
|
52 |
key="canvas"
|
53 |
)
|
54 |
|
55 |
-
|
56 |
-
if st.button("Clear Canvas"):
|
57 |
-
canvas_result.delete("all")
|
58 |
|
59 |
# Add a submit button
|
60 |
if st.button("Submit"):
|
61 |
if canvas_result.json_data:
|
62 |
-
|
|
|
|
|
|
|
63 |
else:
|
64 |
st.text("Please draw an image on the canvas before submitting.")
|
65 |
|
|
|
46 |
stroke_width=3,
|
47 |
stroke_color="rgba(0, 0, 0, 1)",
|
48 |
background_color="rgba(255, 255, 255, 1)",
|
49 |
+
height=128,
|
50 |
+
width=128,
|
51 |
update_streamlit=True,
|
52 |
key="canvas"
|
53 |
)
|
54 |
|
55 |
+
|
|
|
|
|
56 |
|
57 |
# Add a submit button
|
58 |
if st.button("Submit"):
|
59 |
if canvas_result.json_data:
|
60 |
+
image_from_canvas = canvas_result["image_data"]
|
61 |
+
preprocessed_image = preprocess_image(image_from_canvas)
|
62 |
+
predicted_label = predict(preprocessed_image)
|
63 |
+
st.text(f"Predicted label: {predicted_label}")
|
64 |
else:
|
65 |
st.text("Please draw an image on the canvas before submitting.")
|
66 |
|