Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -2,6 +2,20 @@ import streamlit as st
|
|
2 |
import os
|
3 |
from streamlit_extras.stylable_container import stylable_container
|
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
Logo_column, space_column, upload_column, delete_column, browse_column, recycle_column = st.columns(6)
|
7 |
|
@@ -26,7 +40,10 @@ with upload_column:
|
|
26 |
}
|
27 |
""",
|
28 |
):
|
29 |
-
st.button("Upload", key='upload')
|
|
|
|
|
|
|
30 |
|
31 |
with delete_column:
|
32 |
with stylable_container(
|
@@ -81,22 +98,10 @@ with recycle_column:
|
|
81 |
|
82 |
path = "/data"
|
83 |
|
84 |
-
# Define the modal dialog function
|
85 |
-
@st.dialog("Upload a File")
|
86 |
-
def upload_file():
|
87 |
-
uploaded_file = st.file_uploader("Choose a file")
|
88 |
-
if uploaded_file is not None:
|
89 |
-
file_details = {"FileName":uploaded_file.name,"FileType":uploaded_file.type}
|
90 |
-
st.write(file_details)
|
91 |
-
with open(os.path.join(path,uploaded_file.name),"wb") as f:
|
92 |
-
f.write(uploaded_file.getbuffer())
|
93 |
-
st.success("Saved File")
|
94 |
|
95 |
# Main app
|
96 |
st.write("Click the button to open the file upload dialog.")
|
97 |
|
98 |
-
if st.button("Open File Dialog"):
|
99 |
-
upload_file()
|
100 |
|
101 |
|
102 |
|
|
|
2 |
import os
|
3 |
from streamlit_extras.stylable_container import stylable_container
|
4 |
|
5 |
+
# Application Functions
|
6 |
+
# File Loader
|
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 |
+
|
18 |
+
|
19 |
|
20 |
Logo_column, space_column, upload_column, delete_column, browse_column, recycle_column = st.columns(6)
|
21 |
|
|
|
40 |
}
|
41 |
""",
|
42 |
):
|
43 |
+
if st.button("Upload", key='upload')
|
44 |
+
upload_file()
|
45 |
+
|
46 |
+
|
47 |
|
48 |
with delete_column:
|
49 |
with stylable_container(
|
|
|
98 |
|
99 |
path = "/data"
|
100 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
|
102 |
# Main app
|
103 |
st.write("Click the button to open the file upload dialog.")
|
104 |
|
|
|
|
|
105 |
|
106 |
|
107 |
|