Update app.py
Browse files
app.py
CHANGED
|
@@ -152,6 +152,17 @@ class_names.sort()
|
|
| 152 |
|
| 153 |
examples_dir = "sample"
|
| 154 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 155 |
transformation_pipeline = transforms.Compose([
|
| 156 |
transforms.ToPILImage(),
|
| 157 |
transforms.Grayscale(num_output_channels=1),
|
|
@@ -217,6 +228,16 @@ with gr.Blocks() as app:
|
|
| 217 |
with open('index.html', encoding="utf-8") as f:
|
| 218 |
description = f.read()
|
| 219 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 220 |
# gradio code block for input and output
|
| 221 |
with gr.Blocks(theme=gr.themes.Default(primary_hue=page_utils.KALBE_THEME_COLOR, secondary_hue=page_utils.KALBE_THEME_COLOR).set(
|
| 222 |
button_primary_background_fill="*primary_600",
|
|
|
|
| 152 |
|
| 153 |
examples_dir = "sample"
|
| 154 |
|
| 155 |
+
example_image_files = [
|
| 156 |
+
"ISIC_0000108_downsampled.jpeg",
|
| 157 |
+
"ISIC_0000142_downsampled.jpeg",
|
| 158 |
+
"ISIC_0012792_downsampled.jpeg",
|
| 159 |
+
"ISIC_0024452.jpeg",
|
| 160 |
+
"ISIC_0025957.jpeg",
|
| 161 |
+
"ISIC_0026876.jpeg",
|
| 162 |
+
"ISIC_0027385.jpeg",
|
| 163 |
+
"ISIC_0030956.jpeg",
|
| 164 |
+
]
|
| 165 |
+
|
| 166 |
transformation_pipeline = transforms.Compose([
|
| 167 |
transforms.ToPILImage(),
|
| 168 |
transforms.Grayscale(num_output_channels=1),
|
|
|
|
| 228 |
with open('index.html', encoding="utf-8") as f:
|
| 229 |
description = f.read()
|
| 230 |
|
| 231 |
+
if not os.path.exists(examples_dir):
|
| 232 |
+
os.makedirs(examples_dir)
|
| 233 |
+
|
| 234 |
+
# Copy the example image files to the "sample" directory.
|
| 235 |
+
for image_file in example_image_files:
|
| 236 |
+
source_path = os.path.join("path_to_example_images", image_file) # Specify the source directory of the example images
|
| 237 |
+
destination_path = os.path.join(examples_dir, image_file)
|
| 238 |
+
shutil.copy(source_path, destination_path)
|
| 239 |
+
|
| 240 |
+
|
| 241 |
# gradio code block for input and output
|
| 242 |
with gr.Blocks(theme=gr.themes.Default(primary_hue=page_utils.KALBE_THEME_COLOR, secondary_hue=page_utils.KALBE_THEME_COLOR).set(
|
| 243 |
button_primary_background_fill="*primary_600",
|