chengzeyi commited on
Commit
98bf484
·
1 Parent(s): 907793c

add default gallery items to recent gallery

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -506,7 +506,7 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
506
  (r["hidream-dev"], f"HiDream-dev: {r['prompt']}"))
507
  gallery_items.append(
508
  (r["hidream-full"], f"HiDream-full: {r['prompt']}"))
509
- return gallery_items
510
 
511
  def update_recent_gallery(prompt, results):
512
  recent_generations.append({
@@ -517,8 +517,7 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
517
  })
518
  if len(recent_generations) > 16:
519
  recent_generations.pop(0)
520
- gallery_items = get_recent_gallery_items()
521
- return gr.update(value=gallery_items)
522
 
523
  # Add custom CSS for the big status box
524
  css = """
@@ -804,6 +803,12 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
804
  concurrency_id="generation", # Group concurrent requests under this ID
805
  )
806
 
 
 
 
 
 
 
807
  # Launch with increased max_threads
808
  if __name__ == "__main__":
809
  demo.queue(max_size=50).launch(
 
506
  (r["hidream-dev"], f"HiDream-dev: {r['prompt']}"))
507
  gallery_items.append(
508
  (r["hidream-full"], f"HiDream-full: {r['prompt']}"))
509
+ return gr.update(value=gallery_items)
510
 
511
  def update_recent_gallery(prompt, results):
512
  recent_generations.append({
 
517
  })
518
  if len(recent_generations) > 16:
519
  recent_generations.pop(0)
520
+ return get_recent_gallery_items()
 
521
 
522
  # Add custom CSS for the big status box
523
  css = """
 
803
  concurrency_id="generation", # Group concurrent requests under this ID
804
  )
805
 
806
+ demo.load(
807
+ fn=get_recent_gallery_items,
808
+ inputs=None,
809
+ outputs=recent_gallery,
810
+ )
811
+
812
  # Launch with increased max_threads
813
  if __name__ == "__main__":
814
  demo.queue(max_size=50).launch(