Spaces:
Paused
Paused
Upload folder using huggingface_hub
Browse files
app.py
CHANGED
|
@@ -340,7 +340,6 @@ example_prompts = [
|
|
| 340 |
"A sleek, futuristic sports car with glowing blue accents, racing through a virtual reality landscape, 3D render",
|
| 341 |
]
|
| 342 |
|
| 343 |
-
|
| 344 |
# Use a state variable to store session ID
|
| 345 |
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
| 346 |
session_id = gr.State(None) # Add this to store session ID
|
|
@@ -348,25 +347,19 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
| 348 |
gr.Markdown("# 🌊 WaveSpeed AI HiDream Arena")
|
| 349 |
|
| 350 |
# Add the introduction with link to WaveSpeedAI
|
| 351 |
-
gr.Markdown(
|
| 352 |
-
"""
|
| 353 |
[WaveSpeedAI](https://wavespeed.ai/) is the global pioneer in accelerating AI-powered video and image generation.
|
| 354 |
"Our in-house inference accelerator provides lossless speedup on image & video generation based on our rich inference optimization software stack, including our in-house inference compiler, CUDA kernel libraries and parallel computing libraries."
|
| 355 |
-
"""
|
| 356 |
-
|
| 357 |
-
gr.Markdown(
|
| 358 |
-
"""
|
| 359 |
This demo showcases the performance and outputs of leading image generation models, including HiDream and Flux, on our accelerated inference platform.
|
| 360 |
-
"""
|
| 361 |
-
)
|
| 362 |
|
| 363 |
with gr.Row():
|
| 364 |
with gr.Column(scale=3):
|
| 365 |
-
example_dropdown = gr.Dropdown(
|
| 366 |
-
|
| 367 |
-
|
| 368 |
-
interactive=True
|
| 369 |
-
)
|
| 370 |
input_text = gr.Textbox(
|
| 371 |
example_prompts[0],
|
| 372 |
label="Enter your prompt",
|
|
@@ -376,7 +369,9 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
| 376 |
with gr.Column(scale=1):
|
| 377 |
generate_btn = gr.Button("Generate", variant="primary")
|
| 378 |
|
| 379 |
-
example_dropdown.change(lambda ex: ex,
|
|
|
|
|
|
|
| 380 |
|
| 381 |
# Two status boxes - small (default) and big (during generation)
|
| 382 |
small_status_box = gr.Markdown("Ready to generate images",
|
|
@@ -400,13 +395,10 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
| 400 |
performance_plot = gr.Plot(label="Performance Metrics")
|
| 401 |
|
| 402 |
with gr.Accordion("Recent Generations (last 8)", open=False):
|
| 403 |
-
recent_gallery = gr.Gallery(
|
| 404 |
-
|
| 405 |
-
|
| 406 |
-
|
| 407 |
-
columns=4,
|
| 408 |
-
height="auto",
|
| 409 |
-
).style(grid=2)
|
| 410 |
|
| 411 |
def update_recent_gallery(prompt, results):
|
| 412 |
recent_generations.append({
|
|
@@ -417,15 +409,12 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
| 417 |
})
|
| 418 |
if len(recent_generations) > 8:
|
| 419 |
recent_generations.pop(0)
|
| 420 |
-
|
| 421 |
# Flatten the images from each generation
|
| 422 |
all_images = []
|
| 423 |
for gen in reversed(recent_generations): # Show newest first
|
| 424 |
-
all_images.extend(
|
| 425 |
-
gen["flux-dev"],
|
| 426 |
-
gen["hidream-dev"],
|
| 427 |
-
gen["hidream-full"]
|
| 428 |
-
])
|
| 429 |
|
| 430 |
# Update the Gradio gallery with the new list
|
| 431 |
return recent_gallery.update(value=all_images)
|
|
|
|
| 340 |
"A sleek, futuristic sports car with glowing blue accents, racing through a virtual reality landscape, 3D render",
|
| 341 |
]
|
| 342 |
|
|
|
|
| 343 |
# Use a state variable to store session ID
|
| 344 |
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
| 345 |
session_id = gr.State(None) # Add this to store session ID
|
|
|
|
| 347 |
gr.Markdown("# 🌊 WaveSpeed AI HiDream Arena")
|
| 348 |
|
| 349 |
# Add the introduction with link to WaveSpeedAI
|
| 350 |
+
gr.Markdown("""
|
|
|
|
| 351 |
[WaveSpeedAI](https://wavespeed.ai/) is the global pioneer in accelerating AI-powered video and image generation.
|
| 352 |
"Our in-house inference accelerator provides lossless speedup on image & video generation based on our rich inference optimization software stack, including our in-house inference compiler, CUDA kernel libraries and parallel computing libraries."
|
| 353 |
+
""")
|
| 354 |
+
gr.Markdown("""
|
|
|
|
|
|
|
| 355 |
This demo showcases the performance and outputs of leading image generation models, including HiDream and Flux, on our accelerated inference platform.
|
| 356 |
+
""")
|
|
|
|
| 357 |
|
| 358 |
with gr.Row():
|
| 359 |
with gr.Column(scale=3):
|
| 360 |
+
example_dropdown = gr.Dropdown(choices=example_prompts,
|
| 361 |
+
label="Choose an example prompt",
|
| 362 |
+
interactive=True)
|
|
|
|
|
|
|
| 363 |
input_text = gr.Textbox(
|
| 364 |
example_prompts[0],
|
| 365 |
label="Enter your prompt",
|
|
|
|
| 369 |
with gr.Column(scale=1):
|
| 370 |
generate_btn = gr.Button("Generate", variant="primary")
|
| 371 |
|
| 372 |
+
example_dropdown.change(lambda ex: ex,
|
| 373 |
+
inputs=[example_dropdown],
|
| 374 |
+
outputs=[input_text])
|
| 375 |
|
| 376 |
# Two status boxes - small (default) and big (during generation)
|
| 377 |
small_status_box = gr.Markdown("Ready to generate images",
|
|
|
|
| 395 |
performance_plot = gr.Plot(label="Performance Metrics")
|
| 396 |
|
| 397 |
with gr.Accordion("Recent Generations (last 8)", open=False):
|
| 398 |
+
recent_gallery = gr.Gallery(label="Recent Generations",
|
| 399 |
+
columns=3,
|
| 400 |
+
rows=1,
|
| 401 |
+
show_label=True)
|
|
|
|
|
|
|
|
|
|
| 402 |
|
| 403 |
def update_recent_gallery(prompt, results):
|
| 404 |
recent_generations.append({
|
|
|
|
| 409 |
})
|
| 410 |
if len(recent_generations) > 8:
|
| 411 |
recent_generations.pop(0)
|
| 412 |
+
|
| 413 |
# Flatten the images from each generation
|
| 414 |
all_images = []
|
| 415 |
for gen in reversed(recent_generations): # Show newest first
|
| 416 |
+
all_images.extend(
|
| 417 |
+
[gen["flux-dev"], gen["hidream-dev"], gen["hidream-full"]])
|
|
|
|
|
|
|
|
|
|
| 418 |
|
| 419 |
# Update the Gradio gallery with the new list
|
| 420 |
return recent_gallery.update(value=all_images)
|