Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import os
|
| 3 |
+
|
| 4 |
+
# Path to the folder containing images
|
| 5 |
+
image_folder = "images"
|
| 6 |
+
|
| 7 |
+
# Get the list of image files from the folder and prepare the image list
|
| 8 |
+
image_list = [
|
| 9 |
+
(os.path.join(image_folder, filename), os.path.splitext(filename)[0])
|
| 10 |
+
for filename in os.listdir(image_folder)
|
| 11 |
+
if filename.endswith(('.png', '.jpg', '.jpeg', 'webp')) # Add more extensions if needed
|
| 12 |
+
]
|
| 13 |
+
|
| 14 |
+
with gr.Blocks() as demo:
|
| 15 |
+
gr.Gallery(value=image_list, columns=3, show_label=True) # Show the label as the filename
|
| 16 |
+
|
| 17 |
+
demo.launch()
|