Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -63,20 +63,22 @@ def show_image(image, title="Image"):
|
|
63 |
|
64 |
# Function to download sample images
|
65 |
def download_sample_images():
|
66 |
-
|
67 |
-
sample_images = os.listdir(sample_images_folder)
|
68 |
|
69 |
for image_name in sample_images:
|
70 |
-
image_path = os.path.join(
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
|
|
|
|
|
|
80 |
|
81 |
# Streamlit app
|
82 |
def main():
|
|
|
63 |
|
64 |
# Function to download sample images
|
65 |
def download_sample_images():
|
66 |
+
sample_images = ["sample_image1.jpg", "sample_image2.jpg", "sample_image3.jpg"] # Add the names of your sample images
|
|
|
67 |
|
68 |
for image_name in sample_images:
|
69 |
+
image_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), image_name)
|
70 |
+
if os.path.exists(image_path):
|
71 |
+
with open(image_path, "rb") as f:
|
72 |
+
image_bytes = f.read()
|
73 |
+
st.download_button(
|
74 |
+
label=f"Download {image_name}",
|
75 |
+
data=image_bytes,
|
76 |
+
key=f"download_{image_name}",
|
77 |
+
file_name=image_name,
|
78 |
+
mime="image/jpeg",
|
79 |
+
)
|
80 |
+
else:
|
81 |
+
st.warning(f"Sample image {image_name} not found.")
|
82 |
|
83 |
# Streamlit app
|
84 |
def main():
|