seawolf2357
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -53,6 +53,19 @@ def load_generated_images():
|
|
53 |
image_files.sort(key=lambda x: os.path.getctime(x), reverse=True)
|
54 |
return image_files
|
55 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
@spaces.GPU(duration=120)
|
57 |
def inference(
|
58 |
prompt: str,
|
|
|
53 |
image_files.sort(key=lambda x: os.path.getctime(x), reverse=True)
|
54 |
return image_files
|
55 |
|
56 |
+
def load_predefined_images():
|
57 |
+
# You'll need to create an 'assets' directory with your sample images
|
58 |
+
# Return empty list if assets directory or images don't exist
|
59 |
+
if not os.path.exists('assets'):
|
60 |
+
return []
|
61 |
+
|
62 |
+
predefined_images = [
|
63 |
+
os.path.join('assets', f)
|
64 |
+
for f in os.listdir('assets')
|
65 |
+
if f.endswith(('.png', '.jpg', '.jpeg', '.webp'))
|
66 |
+
]
|
67 |
+
return sorted(predefined_images)[:6] # Limit to 6 images
|
68 |
+
|
69 |
@spaces.GPU(duration=120)
|
70 |
def inference(
|
71 |
prompt: str,
|