Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -50,7 +50,7 @@ def list_images(folder: Path):
|
|
| 50 |
|
| 51 |
|
| 52 |
def build_example_rows():
|
| 53 |
-
"""Build up to
|
| 54 |
base = Path(__file__).parent
|
| 55 |
image_exts = (".jpg", ".jpeg", ".png", ".webp", ".JPG", ".JPEG", ".PNG", ".WEBP")
|
| 56 |
root_images = sorted([p for p in base.iterdir() if p.is_file() and p.suffix in image_exts])
|
|
@@ -70,12 +70,12 @@ def build_example_rows():
|
|
| 70 |
|
| 71 |
paired_keys = sorted(set(content_map.keys()) & set(style_map.keys()))
|
| 72 |
if paired_keys:
|
| 73 |
-
return [[content_map[k], style_map[k], 1] for k in paired_keys[:
|
| 74 |
|
| 75 |
# Fallback: pair by sorted order if using generic names.
|
| 76 |
content_files = [str(p) for p in root_images if p.stem.lower().startswith("content")]
|
| 77 |
style_files = [str(p) for p in root_images if p.stem.lower().startswith("style")]
|
| 78 |
-
n = min(
|
| 79 |
return [[content_files[i], style_files[i], 1] for i in range(n)]
|
| 80 |
|
| 81 |
|
|
@@ -272,7 +272,7 @@ with gr.Blocks() as demo:
|
|
| 272 |
fn=infer,
|
| 273 |
cache_examples=False,
|
| 274 |
run_on_click=True,
|
| 275 |
-
examples_per_page=
|
| 276 |
)
|
| 277 |
else:
|
| 278 |
gr.Markdown(
|
|
|
|
| 50 |
|
| 51 |
|
| 52 |
def build_example_rows():
|
| 53 |
+
"""Build up to 4 (content, style, seed) example rows."""
|
| 54 |
base = Path(__file__).parent
|
| 55 |
image_exts = (".jpg", ".jpeg", ".png", ".webp", ".JPG", ".JPEG", ".PNG", ".WEBP")
|
| 56 |
root_images = sorted([p for p in base.iterdir() if p.is_file() and p.suffix in image_exts])
|
|
|
|
| 70 |
|
| 71 |
paired_keys = sorted(set(content_map.keys()) & set(style_map.keys()))
|
| 72 |
if paired_keys:
|
| 73 |
+
return [[content_map[k], style_map[k], 1] for k in paired_keys[:4]]
|
| 74 |
|
| 75 |
# Fallback: pair by sorted order if using generic names.
|
| 76 |
content_files = [str(p) for p in root_images if p.stem.lower().startswith("content")]
|
| 77 |
style_files = [str(p) for p in root_images if p.stem.lower().startswith("style")]
|
| 78 |
+
n = min(4, len(content_files), len(style_files))
|
| 79 |
return [[content_files[i], style_files[i], 1] for i in range(n)]
|
| 80 |
|
| 81 |
|
|
|
|
| 272 |
fn=infer,
|
| 273 |
cache_examples=False,
|
| 274 |
run_on_click=True,
|
| 275 |
+
examples_per_page=4,
|
| 276 |
)
|
| 277 |
else:
|
| 278 |
gr.Markdown(
|