Spaces:
Build error
Build error
Dwnld test
Browse files
app.py
CHANGED
|
@@ -19,6 +19,7 @@ import os
|
|
| 19 |
from plotly.subplots import make_subplots
|
| 20 |
import plotly.graph_objects as go
|
| 21 |
from PIL import Image
|
|
|
|
| 22 |
|
| 23 |
|
| 24 |
# File Imports
|
|
@@ -261,9 +262,9 @@ if st.button('Check for Infringement'):
|
|
| 261 |
with tab1:
|
| 262 |
with st.spinner('Processing...'):
|
| 263 |
|
| 264 |
-
for path in os.listdir('/home/user/app'):
|
| 265 |
print(path)
|
| 266 |
-
if
|
| 267 |
download_db()
|
| 268 |
print("\u2713 Downloaded Database\n\n")
|
| 269 |
|
|
@@ -352,4 +353,22 @@ if st.button('Check for Infringement'):
|
|
| 352 |
# Call the fragment
|
| 353 |
image_viewer()
|
| 354 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 355 |
|
|
|
|
| 19 |
from plotly.subplots import make_subplots
|
| 20 |
import plotly.graph_objects as go
|
| 21 |
from PIL import Image
|
| 22 |
+
import shutil
|
| 23 |
|
| 24 |
|
| 25 |
# File Imports
|
|
|
|
| 262 |
with tab1:
|
| 263 |
with st.spinner('Processing...'):
|
| 264 |
|
| 265 |
+
for path in os.listdir('/home/user/app/embeddings'):
|
| 266 |
print(path)
|
| 267 |
+
if os.path.exists('/home/user/app/embeddings'):
|
| 268 |
download_db()
|
| 269 |
print("\u2713 Downloaded Database\n\n")
|
| 270 |
|
|
|
|
| 353 |
# Call the fragment
|
| 354 |
image_viewer()
|
| 355 |
|
| 356 |
+
def zip_folder(folder_path, zip_name):
|
| 357 |
+
# Create a zip file from the folder
|
| 358 |
+
shutil.make_archive(zip_name, 'zip', folder_path)
|
| 359 |
+
return zip_name + '.zip'
|
| 360 |
+
|
| 361 |
+
folder_path = '/home/user/app/embeddings'
|
| 362 |
+
zip_name = 'embedding'
|
| 363 |
+
|
| 364 |
+
if st.button("Download"):
|
| 365 |
+
zip_file = zip_folder(folder_path, zip_name)
|
| 366 |
+
with open(zip_file, "rb") as f:
|
| 367 |
+
st.download_button(
|
| 368 |
+
label="Download ZIP",
|
| 369 |
+
data=f,
|
| 370 |
+
file_name=zip_file,
|
| 371 |
+
mime="application/zip"
|
| 372 |
+
)
|
| 373 |
+
|
| 374 |
|