Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
#
|
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
|
17 |
if selected_file is not None and selected_file != "None":
|
18 |
-
|
|
|
|
|
|
|
|
|
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")
|