chengzeyi commited on
Commit
42e2f1a
·
1 Parent(s): 9e750f4

fix README

Browse files
Files changed (2) hide show
  1. README.md +2 -1
  2. app.py +27 -27
README.md CHANGED
@@ -6,12 +6,13 @@ colorTo: red
6
  sdk: gradio
7
  sdk_version: 5.0.1
8
  app_file: app.py
9
- pinned: false
10
  license: mit
11
  short_description: Arena for HiDream-I1-dev / -full and FLUX-dev
12
  models:
13
  - HiDream-ai/HiDream-I1-Full
14
  - HiDream-ai/HiDream-I1-Dev
 
15
  ---
16
 
17
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
6
  sdk: gradio
7
  sdk_version: 5.0.1
8
  app_file: app.py
9
+ pinned: true
10
  license: mit
11
  short_description: Arena for HiDream-I1-dev / -full and FLUX-dev
12
  models:
13
  - HiDream-ai/HiDream-I1-Full
14
  - HiDream-ai/HiDream-I1-Dev
15
+ - black-forest-labs/FLUX.1-dev
16
  ---
17
 
18
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
app.py CHANGED
@@ -339,7 +339,6 @@ example_prompts = [
339
  "A sleek, futuristic sports car with glowing blue accents, racing through a virtual reality landscape, 3D render",
340
  ]
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,25 +346,19 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
347
  gr.Markdown("# 🌊 WaveSpeedAI HiDream Arena")
348
 
349
  # Add the introduction with link to WaveSpeedAI
350
- gr.Markdown(
351
- """
352
  [WaveSpeedAI](https://wavespeed.ai/) is the global pioneer in accelerating AI-powered video and image generation.
353
- "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."
354
- """
355
- )
356
- gr.Markdown(
357
- """
358
  This demo showcases the performance and outputs of leading image generation models, including HiDream and Flux, on our accelerated inference platform.
359
- """
360
- )
361
 
362
  with gr.Row():
363
  with gr.Column(scale=3):
364
- example_dropdown = gr.Dropdown(
365
- choices=example_prompts,
366
- label="Choose an example prompt",
367
- interactive=True
368
- )
369
  input_text = gr.Textbox(
370
  example_prompts[0],
371
  label="Enter your prompt",
@@ -375,7 +368,9 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
375
  with gr.Column(scale=1):
376
  generate_btn = gr.Button("Generate", variant="primary")
377
 
378
- example_dropdown.change(lambda ex: ex, inputs=[example_dropdown], outputs=[input_text])
 
 
379
 
380
  # Two status boxes - small (default) and big (during generation)
381
  small_status_box = gr.Markdown("Ready to generate images",
@@ -398,8 +393,20 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
398
 
399
  performance_plot = gr.Plot(label="Performance Metrics")
400
 
401
- with gr.Accordion("Recent Generations (last 8)", open=False):
402
- recent_gallery = gr.Gallery(label="Prompt and Output", columns=3)
 
 
 
 
 
 
 
 
 
 
 
 
403
 
404
  def update_recent_gallery(prompt, results):
405
  recent_generations.append({
@@ -408,16 +415,9 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
408
  "hidream-dev": results["hidream-dev"],
409
  "hidream-full": results["hidream-full"],
410
  })
411
- if len(recent_generations) > 8:
412
  recent_generations.pop(0)
413
- gallery_items = []
414
- for r in reversed(recent_generations):
415
- gallery_items.append(
416
- (r["flux-dev"], f"FLUX-dev: {r['prompt']}"))
417
- gallery_items.append(
418
- (r["hidream-dev"], f"HiDream-dev: {r['prompt']}"))
419
- gallery_items.append(
420
- (r["hidream-full"], f"HiDream-full: {r['prompt']}"))
421
  return gr.update(value=gallery_items)
422
 
423
  # Add custom CSS for the big status box
 
339
  "A sleek, futuristic sports car with glowing blue accents, racing through a virtual reality landscape, 3D render",
340
  ]
341
 
 
342
  # Use a state variable to store session ID
343
  with gr.Blocks(theme=gr.themes.Soft()) as demo:
344
  session_id = gr.State(None) # Add this to store session ID
 
346
  gr.Markdown("# 🌊 WaveSpeedAI HiDream Arena")
347
 
348
  # Add the introduction with link to WaveSpeedAI
349
+ gr.Markdown("""
 
350
  [WaveSpeedAI](https://wavespeed.ai/) is the global pioneer in accelerating AI-powered video and image generation.
351
+ 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.
352
+ """)
353
+ gr.Markdown("""
 
 
354
  This demo showcases the performance and outputs of leading image generation models, including HiDream and Flux, on our accelerated inference platform.
355
+ """)
 
356
 
357
  with gr.Row():
358
  with gr.Column(scale=3):
359
+ example_dropdown = gr.Dropdown(choices=example_prompts,
360
+ label="Choose an example prompt",
361
+ interactive=True)
 
 
362
  input_text = gr.Textbox(
363
  example_prompts[0],
364
  label="Enter your prompt",
 
368
  with gr.Column(scale=1):
369
  generate_btn = gr.Button("Generate", variant="primary")
370
 
371
+ example_dropdown.change(lambda ex: ex,
372
+ inputs=[example_dropdown],
373
+ outputs=[input_text])
374
 
375
  # Two status boxes - small (default) and big (during generation)
376
  small_status_box = gr.Markdown("Ready to generate images",
 
393
 
394
  performance_plot = gr.Plot(label="Performance Metrics")
395
 
396
+ def get_recent_gallery_items():
397
+ gallery_items = []
398
+ for r in reversed(recent_generations):
399
+ gallery_items.append((r["flux-dev"], f"FLUX-dev: {r['prompt']}"))
400
+ gallery_items.append(
401
+ (r["hidream-dev"], f"HiDream-dev: {r['prompt']}"))
402
+ gallery_items.append(
403
+ (r["hidream-full"], f"HiDream-full: {r['prompt']}"))
404
+ return gallery_items
405
+
406
+ with gr.Accordion("Recent Generations (last 16)", open=False):
407
+ recent_gallery = gr.Gallery(get_recent_gallery_items(),
408
+ label="Prompt and Output",
409
+ columns=3)
410
 
411
  def update_recent_gallery(prompt, results):
412
  recent_generations.append({
 
415
  "hidream-dev": results["hidream-dev"],
416
  "hidream-full": results["hidream-full"],
417
  })
418
+ if len(recent_generations) > 16:
419
  recent_generations.pop(0)
420
+ gallery_items = get_recent_gallery_items()
 
 
 
 
 
 
 
421
  return gr.update(value=gallery_items)
422
 
423
  # Add custom CSS for the big status box