Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -216,78 +216,72 @@ device = "cuda" if torch.cuda.is_available() else "cpu"
|
|
216 |
with gr.Blocks(theme="Nymbo/Nymbo_Theme", css=css) as demo:
|
217 |
|
218 |
with gr.Row():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
219 |
|
220 |
-
with gr.Column(variant="panel"):
|
221 |
-
with gr.Row(equal_height=False):
|
222 |
-
with gr.Column():
|
223 |
-
with gr.Row():
|
224 |
-
init_img = gr.Video(label="Input Video")
|
225 |
-
with gr.Row():
|
226 |
-
prompt_textbox = gr.Textbox(value='', label="Prompt", lines=1)
|
227 |
-
with gr.Row():
|
228 |
-
negative_prompt_textbox = gr.Textbox(value=N_PROMPT, label="Negative prompt", lines=1)
|
229 |
-
|
230 |
-
with gr.Row():
|
231 |
-
ip_adapter_scale = gr.Slider(label="Visual Content Scale", value=1.0, minimum=0, maximum=1)
|
232 |
-
temporal_scale = gr.Slider(label="Temporal Align Scale", value=0.2, minimum=0., maximum=1.0)
|
233 |
-
|
234 |
-
with gr.Accordion("Sampling Settings", open=False):
|
235 |
with gr.Row():
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
)
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
generate_button = gr.Button(value="Generate", variant="primary")
|
252 |
-
|
253 |
-
with gr.Column():
|
254 |
-
result_video = gr.Video(label="Generated Audio", interactive=False)
|
255 |
-
with gr.Row():
|
256 |
-
|
257 |
-
generate_button.click(
|
258 |
-
fn=controller.foley,
|
259 |
-
inputs=[
|
260 |
-
init_img,
|
261 |
-
prompt_textbox,
|
262 |
-
negative_prompt_textbox,
|
263 |
-
ip_adapter_scale,
|
264 |
-
temporal_scale,
|
265 |
-
sampler_dropdown,
|
266 |
-
sample_step_slider,
|
267 |
-
cfg_scale_slider,
|
268 |
-
seed_textbox,
|
269 |
-
],
|
270 |
-
outputs=[result_video],
|
271 |
-
)
|
272 |
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
292 |
demo.queue(10)
|
293 |
-
demo.launch(server_name=args.server_name, server_port=args.port, share=args.share, allowed_paths=["./foleycrafter.png"])
|
|
|
216 |
with gr.Blocks(theme="Nymbo/Nymbo_Theme", css=css) as demo:
|
217 |
|
218 |
with gr.Row():
|
219 |
+
with gr.Column(variant="panel"):
|
220 |
+
with gr.Row(equal_height=False):
|
221 |
+
with gr.Column():
|
222 |
+
with gr.Row():
|
223 |
+
init_img = gr.Video(label="Input Video")
|
224 |
+
with gr.Row():
|
225 |
+
prompt_textbox = gr.Textbox(value='', label="Prompt", lines=1)
|
226 |
+
with gr.Row():
|
227 |
+
negative_prompt_textbox = gr.Textbox(value=N_PROMPT, label="Negative prompt", lines=1)
|
228 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
229 |
with gr.Row():
|
230 |
+
ip_adapter_scale = gr.Slider(label="Visual Content Scale", value=1.0, minimum=0, maximum=1)
|
231 |
+
temporal_scale = gr.Slider(label="Temporal Align Scale", value=0.2, minimum=0., maximum=1.0)
|
232 |
+
|
233 |
+
with gr.Accordion("Sampling Settings", open=False):
|
234 |
+
with gr.Row():
|
235 |
+
sampler_dropdown = gr.Dropdown(
|
236 |
+
label="Sampling method",
|
237 |
+
choices=list(scheduler_dict.keys()),
|
238 |
+
value=list(scheduler_dict.keys())[0],
|
239 |
+
)
|
240 |
+
sample_step_slider = gr.Slider(
|
241 |
+
label="Sampling steps", value=25, minimum=10, maximum=100, step=1
|
242 |
+
)
|
243 |
+
cfg_scale_slider = gr.Slider(label="CFG Scale", value=7.5, minimum=0, maximum=20)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
244 |
|
245 |
+
with gr.Row():
|
246 |
+
seed_textbox = gr.Textbox(label="Seed", value=42)
|
247 |
+
seed_button = gr.Button(value="\U0001f3b2", elem_classes="toolbutton")
|
248 |
+
seed_button.click(fn=lambda x: random.randint(1, 1e8), outputs=[seed_textbox], queue=False)
|
249 |
+
|
250 |
+
generate_button = gr.Button(value="Generate", variant="primary")
|
251 |
+
|
252 |
+
with gr.Column():
|
253 |
+
result_video = gr.Video(label="Generated Audio", interactive=False)
|
254 |
+
with gr.Row():
|
255 |
+
pass
|
256 |
+
|
257 |
+
generate_button.click(
|
258 |
+
fn=controller.foley,
|
259 |
+
inputs=[
|
260 |
+
init_img,
|
261 |
+
prompt_textbox,
|
262 |
+
negative_prompt_textbox,
|
263 |
+
ip_adapter_scale,
|
264 |
+
temporal_scale,
|
265 |
+
sampler_dropdown,
|
266 |
+
sample_step_slider,
|
267 |
+
cfg_scale_slider,
|
268 |
+
seed_textbox,
|
269 |
+
],
|
270 |
+
outputs=[result_video],
|
271 |
+
)
|
272 |
+
|
273 |
+
gr.Examples(
|
274 |
+
examples=[
|
275 |
+
['examples/input/case1.mp4', '', '', 1.0, 0.2, 'DDIM', 25, 7.5, 33817921],
|
276 |
+
['examples/input/case3.mp4', '', '', 1.0, 0.2,'DDIM', 25, 7.5, 94667578],
|
277 |
+
['examples/input/case5.mp4', '', '', 0.75, 0.2,'DDIM', 25, 7.5, 92890876],
|
278 |
+
['examples/input/case6.mp4', '', '', 1.0, 0.2, 'DDIM', 25, 7.5, 77015909],
|
279 |
+
],
|
280 |
+
inputs=[init_img, prompt_textbox, negative_prompt_textbox, ip_adapter_scale, temporal_scale, sampler_dropdown, sample_step_slider, cfg_scale_slider, seed_textbox],
|
281 |
+
cache_examples=True,
|
282 |
+
outputs=[result_video],
|
283 |
+
fn=controller.foley,
|
284 |
+
)
|
285 |
+
|
286 |
demo.queue(10)
|
287 |
+
demo.launch(server_name=args.server_name, server_port=args.port, share=args.share, allowed_paths=["./foleycrafter.png"])
|