Spaces:
Paused
Paused
Replace examples table with gallery
Browse files
README.md
CHANGED
|
@@ -33,8 +33,8 @@ for each selected SeFi model repository.
|
|
| 33 |
|
| 34 |
The Space generates fixed 1024x1024 images. The included examples were generated
|
| 35 |
from this Space with `SeFi-Image-1B-turbo` at 1024x1024. Selecting an example
|
| 36 |
-
fills the prompt, parameters, seed,
|
| 37 |
-
|
| 38 |
|
| 39 |
The vendored `sefi/` inference package comes from
|
| 40 |
`jmliu206/SeFi-Image` at commit `2f02744a187639ee41a296f8177cbbe7e5f333f5`
|
|
|
|
| 33 |
|
| 34 |
The Space generates fixed 1024x1024 images. The included examples were generated
|
| 35 |
from this Space with `SeFi-Image-1B-turbo` at 1024x1024. Selecting an example
|
| 36 |
+
fills the prompt, parameters, seed, and output image while leaving the randomized
|
| 37 |
+
seed option enabled for the next generation.
|
| 38 |
|
| 39 |
The vendored `sefi/` inference package comes from
|
| 40 |
`jmliu206/SeFi-Image` at commit `2f02744a187639ee41a296f8177cbbe7e5f333f5`
|
app.py
CHANGED
|
@@ -157,23 +157,16 @@ def _model_choices() -> list[tuple[str, str]]:
|
|
| 157 |
return [(preset.label, key) for key, preset in MODEL_PRESETS.items()]
|
| 158 |
|
| 159 |
|
| 160 |
-
def
|
| 161 |
-
|
| 162 |
for example in EXAMPLES:
|
| 163 |
preset = MODEL_PRESETS[str(example["model_key"])]
|
| 164 |
-
|
| 165 |
-
[
|
| 166 |
-
|
| 167 |
-
str(example["label"]),
|
| 168 |
-
preset.label,
|
| 169 |
-
str(example["prompt"]),
|
| 170 |
-
f"{IMAGE_SIZE}x{IMAGE_SIZE}",
|
| 171 |
-
int(example["steps"]),
|
| 172 |
-
float(example["guidance"]),
|
| 173 |
-
int(example["seed"]),
|
| 174 |
-
]
|
| 175 |
)
|
| 176 |
-
|
|
|
|
| 177 |
|
| 178 |
|
| 179 |
def _torch_cleanup() -> None:
|
|
@@ -342,6 +335,24 @@ def generate(
|
|
| 342 |
)
|
| 343 |
|
| 344 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 345 |
with gr.Blocks(title="SeFi Image ZeroGPU") as demo:
|
| 346 |
gr.Markdown("# SeFi Image ZeroGPU")
|
| 347 |
|
|
@@ -396,25 +407,17 @@ with gr.Blocks(title="SeFi Image ZeroGPU") as demo:
|
|
| 396 |
)
|
| 397 |
)
|
| 398 |
|
| 399 |
-
examples = gr.
|
| 400 |
-
value=
|
| 401 |
-
headers=[
|
| 402 |
-
"Image",
|
| 403 |
-
"Example",
|
| 404 |
-
"Model",
|
| 405 |
-
"Prompt",
|
| 406 |
-
"Size",
|
| 407 |
-
"Steps",
|
| 408 |
-
"Guidance",
|
| 409 |
-
"Seed",
|
| 410 |
-
],
|
| 411 |
-
datatype=["image", "str", "str", "str", "str", "number", "number", "number"],
|
| 412 |
-
type="array",
|
| 413 |
label="Examples",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 414 |
interactive=False,
|
| 415 |
-
|
| 416 |
-
|
| 417 |
-
column_widths=["96px", "140px", "180px", "360px", "110px", "90px", "90px", "90px"],
|
| 418 |
)
|
| 419 |
|
| 420 |
model.change(model_defaults, inputs=model, outputs=[steps, guidance, status])
|
|
@@ -451,4 +454,4 @@ with gr.Blocks(title="SeFi Image ZeroGPU") as demo:
|
|
| 451 |
demo.queue(default_concurrency_limit=1)
|
| 452 |
|
| 453 |
if __name__ == "__main__":
|
| 454 |
-
demo.launch(allowed_paths=[str(EXAMPLE_ASSETS_DIR)])
|
|
|
|
| 157 |
return [(preset.label, key) for key, preset in MODEL_PRESETS.items()]
|
| 158 |
|
| 159 |
|
| 160 |
+
def _example_gallery() -> list[tuple[str, str]]:
|
| 161 |
+
items = []
|
| 162 |
for example in EXAMPLES:
|
| 163 |
preset = MODEL_PRESETS[str(example["model_key"])]
|
| 164 |
+
caption = (
|
| 165 |
+
f"{example['label']} | {preset.label} | "
|
| 166 |
+
f"{example['steps']} steps | seed {example['seed']}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 167 |
)
|
| 168 |
+
items.append((str(example["image"]), caption))
|
| 169 |
+
return items
|
| 170 |
|
| 171 |
|
| 172 |
def _torch_cleanup() -> None:
|
|
|
|
| 335 |
)
|
| 336 |
|
| 337 |
|
| 338 |
+
APP_CSS = """
|
| 339 |
+
#examples_gallery {
|
| 340 |
+
width: 100%;
|
| 341 |
+
}
|
| 342 |
+
|
| 343 |
+
#examples_gallery img {
|
| 344 |
+
aspect-ratio: 1 / 1;
|
| 345 |
+
object-fit: cover;
|
| 346 |
+
}
|
| 347 |
+
|
| 348 |
+
#examples_gallery figcaption,
|
| 349 |
+
#examples_gallery .caption {
|
| 350 |
+
white-space: normal;
|
| 351 |
+
line-height: 1.35;
|
| 352 |
+
}
|
| 353 |
+
"""
|
| 354 |
+
|
| 355 |
+
|
| 356 |
with gr.Blocks(title="SeFi Image ZeroGPU") as demo:
|
| 357 |
gr.Markdown("# SeFi Image ZeroGPU")
|
| 358 |
|
|
|
|
| 407 |
)
|
| 408 |
)
|
| 409 |
|
| 410 |
+
examples = gr.Gallery(
|
| 411 |
+
value=_example_gallery(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 412 |
label="Examples",
|
| 413 |
+
columns=3,
|
| 414 |
+
rows=None,
|
| 415 |
+
height=None,
|
| 416 |
+
object_fit="cover",
|
| 417 |
+
allow_preview=False,
|
| 418 |
interactive=False,
|
| 419 |
+
type="filepath",
|
| 420 |
+
elem_id="examples_gallery",
|
|
|
|
| 421 |
)
|
| 422 |
|
| 423 |
model.change(model_defaults, inputs=model, outputs=[steps, guidance, status])
|
|
|
|
| 454 |
demo.queue(default_concurrency_limit=1)
|
| 455 |
|
| 456 |
if __name__ == "__main__":
|
| 457 |
+
demo.launch(allowed_paths=[str(EXAMPLE_ASSETS_DIR)], css=APP_CSS)
|