Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -2,6 +2,9 @@ import streamlit as st
|
|
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")
|
@@ -14,6 +17,26 @@ def upload_file():
|
|
14 |
f.write(uploaded_file.getbuffer())
|
15 |
st.success("Saved File")
|
16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
|
19 |
|
@@ -96,7 +119,7 @@ with recycle_column:
|
|
96 |
|
97 |
|
98 |
|
99 |
-
|
100 |
|
101 |
|
102 |
# Main app
|
@@ -107,13 +130,7 @@ st.write("Click the button to open the file upload dialog.")
|
|
107 |
|
108 |
|
109 |
|
110 |
-
# List all files in directory and subdirectories
|
111 |
-
files = []
|
112 |
-
for root, dirs, file_names in os.walk(path):
|
113 |
-
for file_name in file_names:
|
114 |
-
files.append(os.path.join(root, file_name))
|
115 |
|
116 |
-
st.write(files)
|
117 |
|
118 |
|
119 |
|
|
|
2 |
import os
|
3 |
from streamlit_extras.stylable_container import stylable_container
|
4 |
|
5 |
+
# Variables used Globally
|
6 |
+
path = "/data"
|
7 |
+
|
8 |
# Application Functions
|
9 |
# File Loader
|
10 |
@st.dialog("Upload a File")
|
|
|
17 |
f.write(uploaded_file.getbuffer())
|
18 |
st.success("Saved File")
|
19 |
|
20 |
+
# File Loader
|
21 |
+
@st.dialog("Delete a File")
|
22 |
+
def delete_file():
|
23 |
+
# List all files in directory and subdirectories
|
24 |
+
files = []
|
25 |
+
for root, dirs, file_names in os.walk(path):
|
26 |
+
for file_name in file_names:
|
27 |
+
files.append(os.path.join(root, file_name))
|
28 |
+
|
29 |
+
st.write(files)
|
30 |
+
|
31 |
+
|
32 |
+
uploaded_file = st.file_uploader("Choose a file")
|
33 |
+
if uploaded_file is not None:
|
34 |
+
file_details = {"FileName":uploaded_file.name,"FileType":uploaded_file.type}
|
35 |
+
st.write(file_details)
|
36 |
+
with open(os.path.join(path,uploaded_file.name),"wb") as f:
|
37 |
+
f.write(uploaded_file.getbuffer())
|
38 |
+
st.success("Saved File")
|
39 |
+
|
40 |
|
41 |
|
42 |
|
|
|
119 |
|
120 |
|
121 |
|
122 |
+
|
123 |
|
124 |
|
125 |
# Main app
|
|
|
130 |
|
131 |
|
132 |
|
|
|
|
|
|
|
|
|
|
|
133 |
|
|
|
134 |
|
135 |
|
136 |
|