multimodalart HF staff commited on
Commit
43cc6f1
1 Parent(s): 0a2783f

Swap to gallery for performance

Browse files

When receiving a `path`, `gr.Gallery` skips the base64 conversion

Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -135,7 +135,7 @@ def generate(
135
  ).images[0]
136
 
137
  image_path = save_image(image)
138
- return image_path
139
 
140
 
141
  examples = ['3d digital art of an adorable ghost, glowing within, holding a heart shaped pumpkin, Halloween, super cute, spooky haunted house background', 'beautiful lady, freckles, big smile, blue eyes, short ginger hair, dark makeup, wearing a floral blue vest top, soft light, dark grey background', 'professional portrait photo of an anthropomorphic cat wearing fancy gentleman hat and jacket walking in autumn forest.', 'an astronaut sitting in a diner, eating fries, cinematic, analog film', 'Albert Einstein in a surrealist Cyberpunk 2077 world, hyperrealistic', 'cinematic film still of Futuristic hero with golden dark armour with machine gun, muscular body']
@@ -157,7 +157,7 @@ with gr.Blocks(css="style.css") as demo:
157
  container=False,
158
  )
159
  run_button = gr.Button("Run", scale=0)
160
- result = gr.Image(label="Result", show_label=False)
161
  with gr.Accordion("Advanced options", open=False):
162
  with gr.Row():
163
  use_negative_prompt = gr.Checkbox(label="Use negative prompt", value=False)
@@ -300,7 +300,7 @@ with gr.Blocks(css="style.css") as demo:
300
  apply_refiner,
301
  randomize_seed
302
  ],
303
- outputs=result,
304
  api_name="run",
305
  )
306
 
 
135
  ).images[0]
136
 
137
  image_path = save_image(image)
138
+ return gr.Gallery(value=[image_path], selected_index=0), seed
139
 
140
 
141
  examples = ['3d digital art of an adorable ghost, glowing within, holding a heart shaped pumpkin, Halloween, super cute, spooky haunted house background', 'beautiful lady, freckles, big smile, blue eyes, short ginger hair, dark makeup, wearing a floral blue vest top, soft light, dark grey background', 'professional portrait photo of an anthropomorphic cat wearing fancy gentleman hat and jacket walking in autumn forest.', 'an astronaut sitting in a diner, eating fries, cinematic, analog film', 'Albert Einstein in a surrealist Cyberpunk 2077 world, hyperrealistic', 'cinematic film still of Futuristic hero with golden dark armour with machine gun, muscular body']
 
157
  container=False,
158
  )
159
  run_button = gr.Button("Run", scale=0)
160
+ result = gr.Gallery(label="Result", show_label=False)
161
  with gr.Accordion("Advanced options", open=False):
162
  with gr.Row():
163
  use_negative_prompt = gr.Checkbox(label="Use negative prompt", value=False)
 
300
  apply_refiner,
301
  randomize_seed
302
  ],
303
+ outputs=[result, seed],
304
  api_name="run",
305
  )
306