kh-CHEUNG commited on
Commit
d9e2f7d
·
verified ·
1 Parent(s): a385b9c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -9,13 +9,17 @@ import streamlit as st
9
  st.title("CIC Demo (by ITT)")
10
  st.write("Select or upload a document (/an image) to test the model.")
11
 
12
- # Image selection
13
- uploaded_files = st.file_uploader("Upload document(s) [/image(s)]:", type=["docx", "pdf", "jpg", "jpeg", "png"], accept_multiple_files=True)
14
  selected_file = st.selectbox("Select a document (/an image):", uploaded_files, format_func=lambda file: file.name if file else "None")
15
 
16
- # Display selected image
17
  if selected_file is not None and selected_file != "None":
18
- st.image(selected_file, caption="Selected Image")
 
 
 
 
19
 
20
  # Model testing button
21
  testButton = st.button("Test Model")
 
9
  st.title("CIC Demo (by ITT)")
10
  st.write("Select or upload a document (/an image) to test the model.")
11
 
12
+ # File selection
13
+ uploaded_files = st.file_uploader("Upload document(s) [/image(s)]:", type=["docx", "pdf", "pptx", "jpg", "jpeg", "png"], accept_multiple_files=True)
14
  selected_file = st.selectbox("Select a document (/an image):", uploaded_files, format_func=lambda file: file.name if file else "None")
15
 
16
+ # Display selected file
17
  if selected_file is not None and selected_file != "None":
18
+ file_extension = selected_file.name.split(".")[-1]
19
+ if file_extension in ["jpg", "jpeg", "png"]:
20
+ st.image(selected_file, caption="Selected Image")
21
+ else:
22
+ st.write("Selected file: ", selected_file.name)
23
 
24
  # Model testing button
25
  testButton = st.button("Test Model")