linoyts HF Staff commited on
Commit
8845a97
·
verified ·
1 Parent(s): b8f2c17

Populate-only examples (fix click break) + audio in closed accordion

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -170,7 +170,8 @@ with gr.Blocks(title="FastH3 OmniRef", theme=THEME, css=CSS) as demo:
170
  img1 = gr.Image(label="Reference 1 · required", type="numpy", height=190)
171
  img2 = gr.Image(label="Reference 2 · optional", type="numpy", height=190)
172
  img3 = gr.Image(label="Reference 3 · optional", type="numpy", height=190)
173
- audio = gr.Audio(label="Reference audio · optional (voice / sound to follow)", type="filepath")
 
174
  prompt = gr.Textbox(
175
  label="Prompt — the action, scene and sound",
176
  value=DEFAULT_PROMPT,
@@ -198,14 +199,13 @@ with gr.Blocks(title="FastH3 OmniRef", theme=THEME, css=CSS) as demo:
198
 
199
  inputs = [prompt, img1, img2, img3, audio, resolution, length, seed]
200
 
 
 
 
201
  gr.Examples(
202
- label="Examples — click to load a reference image + prompt, then Generate",
203
  examples=EXAMPLES,
204
  inputs=inputs,
205
- outputs=[result],
206
- fn=generate,
207
- cache_examples=True,
208
- cache_mode="lazy", # cache on first click (GPU ready), not at build time
209
  )
210
 
211
  run.click(generate, inputs=inputs, outputs=[result], api_name="generate")
 
170
  img1 = gr.Image(label="Reference 1 · required", type="numpy", height=190)
171
  img2 = gr.Image(label="Reference 2 · optional", type="numpy", height=190)
172
  img3 = gr.Image(label="Reference 3 · optional", type="numpy", height=190)
173
+ with gr.Accordion("Reference audio (optional)", open=False):
174
+ audio = gr.Audio(label="Voice / sound for the clip to follow", type="filepath")
175
  prompt = gr.Textbox(
176
  label="Prompt — the action, scene and sound",
177
  value=DEFAULT_PROMPT,
 
199
 
200
  inputs = [prompt, img1, img2, img3, audio, resolution, length, seed]
201
 
202
+ # Populate-only: clicking loads the reference image + prompt + settings into
203
+ # the inputs; the user then presses Generate. (Caching the examples would run
204
+ # the ~5-min cold GPU build inside the examples runner, which is fragile.)
205
  gr.Examples(
206
+ label="Examples — click to load a reference image + prompt, then press Generate",
207
  examples=EXAMPLES,
208
  inputs=inputs,
 
 
 
 
209
  )
210
 
211
  run.click(generate, inputs=inputs, outputs=[result], api_name="generate")