Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,28 +1,49 @@
|
|
|
|
1 |
import streamlit as st
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
|
|
|
|
|
|
6 |
|
7 |
-
|
8 |
-
|
9 |
|
10 |
-
|
11 |
-
|
12 |
-
bytes_data = uploaded_file.getvalue()
|
13 |
|
14 |
-
|
15 |
-
|
16 |
-
|
|
|
17 |
|
18 |
-
#
|
19 |
-
|
20 |
-
for i, image in enumerate(images):
|
21 |
-
dot.node(str(i), image=image)
|
22 |
|
23 |
-
|
24 |
-
|
25 |
|
26 |
-
#
|
27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
import streamlit as st
|
3 |
+
from io import BytesIO
|
4 |
+
|
5 |
+
# Create a sidebar to display the list of uploaded files
|
6 |
+
uploaded_files = st.sidebar.empty()
|
7 |
+
|
8 |
+
# Use the file uploader to accept multiple files
|
9 |
+
files = st.file_uploader("Choose files", accept_multiple_files=True)
|
10 |
|
11 |
+
# Create a div to display the uploaded files
|
12 |
+
div = st.empty()
|
13 |
|
14 |
+
# Initialize a list to store the uploaded files
|
15 |
+
file_list = []
|
|
|
16 |
|
17 |
+
# Loop through the uploaded files and add them to the file list
|
18 |
+
for file in files:
|
19 |
+
# Read the file as bytes
|
20 |
+
bytes_data = file.read()
|
21 |
|
22 |
+
# Add the file to the file list
|
23 |
+
file_list.append(bytes_data)
|
|
|
|
|
24 |
|
25 |
+
# Update the sidebar to display the list of uploaded files
|
26 |
+
uploaded_files.write([file.name for file in files])
|
27 |
|
28 |
+
# Use HTML and CSS to style the div and move it around the screen
|
29 |
+
div.markdown("""
|
30 |
+
<style>
|
31 |
+
.sticky {
|
32 |
+
position: fixed;
|
33 |
+
bottom: 20px;
|
34 |
+
right: 20px;
|
35 |
+
padding: 10px;
|
36 |
+
background-color: #f5f5f5;
|
37 |
+
border: 1px solid #d3d3d3;
|
38 |
+
border-radius: 4px;
|
39 |
+
text-align: center;
|
40 |
+
font-size: 18px;
|
41 |
+
box-shadow: 2px 2px #888888;
|
42 |
+
}
|
43 |
+
</style>
|
44 |
+
""", unsafe_allow_html=True)
|
45 |
|
46 |
+
# Add the uploaded files to the div and make it move around the screen
|
47 |
+
if file_list:
|
48 |
+
for file in file_list:
|
49 |
+
div.markdown(f'<div class="sticky">{file}</div>', unsafe_allow_html=True)
|