Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -7,7 +7,7 @@ import base64
|
|
7 |
import cv2
|
8 |
import numpy as np
|
9 |
import matplotlib.pyplot as plt
|
10 |
-
|
11 |
H = 256
|
12 |
W = 256
|
13 |
|
@@ -61,6 +61,23 @@ def show_image(image, title="Image"):
|
|
61 |
plt.axis('off')
|
62 |
st.pyplot()
|
63 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
# Streamlit app
|
65 |
def main():
|
66 |
st.title("Brain Tumor Segmentation App")
|
|
|
7 |
import cv2
|
8 |
import numpy as np
|
9 |
import matplotlib.pyplot as plt
|
10 |
+
|
11 |
H = 256
|
12 |
W = 256
|
13 |
|
|
|
61 |
plt.axis('off')
|
62 |
st.pyplot()
|
63 |
|
64 |
+
# Function to download sample images
|
65 |
+
def download_sample_images():
|
66 |
+
sample_images_folder = "sample_images"
|
67 |
+
sample_images = os.listdir(sample_images_folder)
|
68 |
+
|
69 |
+
for image_name in sample_images:
|
70 |
+
image_path = os.path.join(sample_images_folder, image_name)
|
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 |
+
|
81 |
# Streamlit app
|
82 |
def main():
|
83 |
st.title("Brain Tumor Segmentation App")
|