Spaces:
Build error
Build error
crashedice
commited on
Commit
•
d9e2a5c
1
Parent(s):
1486f94
Update pages/1_Detection.py
Browse files- pages/1_Detection.py +4 -3
pages/1_Detection.py
CHANGED
@@ -20,15 +20,16 @@ st.session_state.selection = "" if "selection" not in st.session_state else st.s
|
|
20 |
left, right = st.columns(2)
|
21 |
selection = str(left.selectbox('Select document', os.listdir(MEDIA_ROOT)))
|
22 |
st.session_state.predict = st.button('Detect')
|
|
|
|
|
23 |
|
24 |
if st.session_state.predict and st.session_state.selection:
|
25 |
latest_detection = max(glob.glob(os.path.join(YOLO_RESULT, '*/')), key=os.path.getmtime)
|
26 |
selection_detection =latest_detection + YOLO_OP + selection[:-4] + '.jpg'
|
27 |
-
|
28 |
elif selection != st.session_state.selection:
|
29 |
st.session_state.selection = selection
|
30 |
detect.detect(MEDIA_ROOT)
|
31 |
-
|
32 |
-
left.image(selection_image_left, use_column_width='always')
|
33 |
|
34 |
|
|
|
20 |
left, right = st.columns(2)
|
21 |
selection = str(left.selectbox('Select document', os.listdir(MEDIA_ROOT)))
|
22 |
st.session_state.predict = st.button('Detect')
|
23 |
+
selection_image_left = MEDIA_ROOT+selection
|
24 |
+
left.image(selection_image_left, use_column_width='always')
|
25 |
|
26 |
if st.session_state.predict and st.session_state.selection:
|
27 |
latest_detection = max(glob.glob(os.path.join(YOLO_RESULT, '*/')), key=os.path.getmtime)
|
28 |
selection_detection =latest_detection + YOLO_OP + selection[:-4] + '.jpg'
|
29 |
+
right.image(selection_detection)
|
30 |
elif selection != st.session_state.selection:
|
31 |
st.session_state.selection = selection
|
32 |
detect.detect(MEDIA_ROOT)
|
33 |
+
|
|
|
34 |
|
35 |
|