Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -21,51 +21,3 @@ if uploaded_file is not None:
|
|
21 |
item = cv2.resize(bytes_data,dsize=(224,224), interpolation=cv2.INTER_CUBIC)
|
22 |
# ReScale Values
|
23 |
item = item / 255
|
24 |
-
|
25 |
-
|
26 |
-
# Create a sidebar to display the list of uploaded files
|
27 |
-
uploaded_files = st.sidebar.empty()
|
28 |
-
|
29 |
-
# Use the file uploader to accept multiple files
|
30 |
-
files = st.file_uploader("Choose files", accept_multiple_files=True)
|
31 |
-
|
32 |
-
# Create a div to display the uploaded files
|
33 |
-
div = st.empty()
|
34 |
-
|
35 |
-
# Initialize a list to store the uploaded files
|
36 |
-
file_list = []
|
37 |
-
|
38 |
-
# Loop through the uploaded files and add them to the file list
|
39 |
-
for file in files:
|
40 |
-
# Read the file as bytes
|
41 |
-
bytes_data = file.read()
|
42 |
-
|
43 |
-
# Add the file to the file list
|
44 |
-
file_list.append(bytes_data)
|
45 |
-
|
46 |
-
# Update the sidebar to display the list of uploaded files
|
47 |
-
uploaded_files.write([file.name for file in files])
|
48 |
-
|
49 |
-
# Use HTML and CSS to style the div and move it around the screen
|
50 |
-
div.markdown("""
|
51 |
-
<style>
|
52 |
-
.sticky {
|
53 |
-
position: fixed;
|
54 |
-
bottom: 20px;
|
55 |
-
right: 20px;
|
56 |
-
padding: 10px;
|
57 |
-
background-color: #f5f5f5;
|
58 |
-
border: 1px solid #d3d3d3;
|
59 |
-
border-radius: 4px;
|
60 |
-
text-align: center;
|
61 |
-
font-size: 18px;
|
62 |
-
box-shadow: 2px 2px #888888;
|
63 |
-
}
|
64 |
-
</style>
|
65 |
-
""", unsafe_allow_html=True)
|
66 |
-
|
67 |
-
# Add the uploaded files to the div as an anchor tag with an image that opens in a new tab
|
68 |
-
if file_list:
|
69 |
-
for file in file_list:
|
70 |
-
url = "https://huggingface.co/spaces/awacke1/CardCrafter-CraftCustomCards" # Replace with the URL to open when the image is clicked
|
71 |
-
div.markdown(f'<a href="{url}" target="_blank"><img src="{file.name}" class="sticky"></a>', unsafe_allow_html=True)
|
|
|
21 |
item = cv2.resize(bytes_data,dsize=(224,224), interpolation=cv2.INTER_CUBIC)
|
22 |
# ReScale Values
|
23 |
item = item / 255
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|