Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,28 +1,26 @@
|
|
1 |
import streamlit as st
|
2 |
import os
|
3 |
|
4 |
-
x = st.slider('Select a value')
|
5 |
-
st.write(x, 'squared is', x * x)
|
6 |
-
|
7 |
-
|
8 |
path = "/data"
|
9 |
|
10 |
-
#
|
11 |
-
|
12 |
-
|
13 |
-
st.
|
14 |
-
|
15 |
-
|
|
|
|
|
|
|
|
|
16 |
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
|
19 |
-
uploaded_file = st.file_uploader("Upload File")
|
20 |
-
if uploaded_file is not None:
|
21 |
-
file_details = {"FileName":uploaded_file.name,"FileType":uploaded_file.type}
|
22 |
-
st.write(file_details)
|
23 |
-
with open(os.path.join(path,uploaded_file.name),"wb") as f:
|
24 |
-
f.write(uploaded_file.getbuffer())
|
25 |
-
st.success("Saved File")
|
26 |
|
27 |
|
28 |
|
|
|
1 |
import streamlit as st
|
2 |
import os
|
3 |
|
|
|
|
|
|
|
|
|
4 |
path = "/data"
|
5 |
|
6 |
+
# Define the modal dialog function
|
7 |
+
@st.dialog("Upload a File")
|
8 |
+
def upload_file():
|
9 |
+
uploaded_file = st.file_uploader("Choose a file")
|
10 |
+
if uploaded_file is not None:
|
11 |
+
file_details = {"FileName":uploaded_file.name,"FileType":uploaded_file.type}
|
12 |
+
st.write(file_details)
|
13 |
+
with open(os.path.join(path,uploaded_file.name),"wb") as f:
|
14 |
+
f.write(uploaded_file.getbuffer())
|
15 |
+
st.success("Saved File")
|
16 |
|
17 |
+
# Main app
|
18 |
+
st.write("Click the button to open the file upload dialog.")
|
19 |
+
|
20 |
+
if st.button("Open File Dialog"):
|
21 |
+
upload_file()
|
22 |
|
23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
|
26 |
|