Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,7 @@
|
|
1 |
import streamlit as st
|
|
|
|
|
|
|
2 |
import cv2
|
3 |
import pandas
|
4 |
from PIL import Image
|
@@ -22,13 +25,24 @@ img_width = 224
|
|
22 |
class_names = ['Palm', 'Others']
|
23 |
model = tf.keras.models.load_model('model')
|
24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
#Generate_pred = st.button("Generate Prediction")
|
26 |
-
with st.form("form", clear_on_submit=True):
|
27 |
-
uploaded_file = st.file_uploader("Upload image files", type="jpg", accept_multiple_files=True)
|
28 |
-
if uploaded_file is not None:
|
29 |
-
st.image(uploaded_file, width=100)
|
30 |
|
31 |
-
submitted = st.form_submit_button("Toggle here to predict or to delete the data")
|
32 |
|
33 |
# if submitted and uploaded_file is not None:
|
34 |
|
|
|
1 |
import streamlit as st
|
2 |
+
from random import randint
|
3 |
+
from .session_state import get_session_state
|
4 |
+
|
5 |
import cv2
|
6 |
import pandas
|
7 |
from PIL import Image
|
|
|
25 |
class_names = ['Palm', 'Others']
|
26 |
model = tf.keras.models.load_model('model')
|
27 |
|
28 |
+
state = get_session_state()
|
29 |
+
if not state.widget_key:
|
30 |
+
state.widget_key = str(randint(1000, 100000000))
|
31 |
+
|
32 |
+
uploaded_file = st.file_uploader(
|
33 |
+
"Choose a file", accept_multiple_files=True, key=state.widget_key)
|
34 |
+
|
35 |
+
if st.button('clear uploaded_file'):
|
36 |
+
state.widget_key = str(randint(1000, 100000000))
|
37 |
+
state.sync()
|
38 |
+
|
39 |
#Generate_pred = st.button("Generate Prediction")
|
40 |
+
#with st.form("form", clear_on_submit=True):
|
41 |
+
# uploaded_file = st.file_uploader("Upload image files", type="jpg", accept_multiple_files=True)
|
42 |
+
# if uploaded_file is not None:
|
43 |
+
# st.image(uploaded_file, width=100)
|
44 |
|
45 |
+
# submitted = st.form_submit_button("Toggle here to predict or to delete the data")
|
46 |
|
47 |
# if submitted and uploaded_file is not None:
|
48 |
|