fantaxy commited on
Commit
2abccfc
·
verified ·
1 Parent(s): bb10e34

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +42 -46
app.py CHANGED
@@ -257,49 +257,46 @@ def ui():
257
  # Text+Image to Video Generation
258
  """
259
  )
260
-
261
- with gr.Row():
262
- prompt_textbox = gr.Textbox(label="Prompt", lines=2)
263
- negative_prompt_textbox = gr.Textbox(label="Negative prompt", lines=2)
264
-
265
- with gr.Row(equal_height=False):
266
- with gr.Column():
267
- with gr.Row():
268
- sampler_dropdown = gr.Dropdown(label="Sampling method", choices=list(scheduler_dict.keys()), value=list(scheduler_dict.keys())[0])
269
- sample_step_slider = gr.Slider(label="Sampling steps", value=50, minimum=10, maximum=250, step=1)
270
-
271
- with gr.Row():
272
- center_crop = gr.Checkbox(label="Center Crop the Image", value=True)
273
- width_slider = gr.Slider(label="Width", value=256, minimum=0, maximum=512, step=64)
274
- height_slider = gr.Slider(label="Height", value=256, minimum=0, maximum=512, step=64)
275
- with gr.Row():
276
- txt_cfg_scale_slider = gr.Slider(label="Text CFG Scale", value=7.5, minimum=1.0, maximum=20.0, step=0.5)
277
- img_cfg_scale_slider = gr.Slider(label="Image CFG Scale", value=1.0, minimum=1.0, maximum=20.0, step=0.5)
278
- frame_stride = gr.Slider(label="Frame Stride", value=3, minimum=1, maximum=5, step=1)
279
-
280
- with gr.Row():
281
- use_frameinit = gr.Checkbox(label="Enable FrameInit", value=True)
282
- frameinit_noise_level = gr.Slider(label="FrameInit Noise Level", value=850, minimum=1, maximum=999, step=1)
283
-
284
-
285
- seed_textbox = gr.Textbox(label="Seed", value=-1)
286
- seed_button = gr.Button(value="\U0001F3B2", elem_classes="toolbutton")
287
- seed_button.click(fn=lambda: gr.Textbox(value=random.randint(1, 1e8)), inputs=[], outputs=[seed_textbox])
288
-
289
-
290
-
291
- generate_button = gr.Button(value="Generate", variant='primary')
292
-
293
- with gr.Column():
294
- with gr.Row():
295
- input_image_path = gr.Textbox(label="Input Image URL", lines=1, scale=10, info="Press Enter or the Preview button to confirm the input image.")
296
- preview_button = gr.Button(value="Preview")
297
-
298
- with gr.Row():
299
- input_image = gr.Image(label="Input Image", interactive=True)
300
- input_image.upload(fn=update_textbox_and_save_image, inputs=[input_image, height_slider, width_slider, center_crop], outputs=[input_image_path, input_image])
301
- result_video = gr.Video(label="Generated Animation", interactive=False, autoplay=True)
302
-
303
  with gr.Row():
304
  batch_examples = gr.Examples(
305
  examples=EXAMPLES,
@@ -309,7 +306,7 @@ def ui():
309
  inputs=[prompt_textbox, input_image],
310
  outputs=[prompt_textbox, input_image, input_image_path, width_slider, height_slider, center_crop, seed_textbox],
311
  )
312
-
313
  preview_button.click(fn=update_and_resize_image, inputs=[input_image_path, height_slider, width_slider, center_crop], outputs=[input_image])
314
  input_image_path.submit(fn=update_and_resize_image, inputs=[input_image_path, height_slider, width_slider, center_crop], outputs=[input_image])
315
 
@@ -333,8 +330,7 @@ def ui():
333
  ],
334
  outputs=[result_video]
335
  )
336
-
337
-
338
  return demo
339
 
340
 
 
257
  # Text+Image to Video Generation
258
  """
259
  )
260
+
261
+ with gr.Row():
262
+ prompt_textbox = gr.Textbox(label="Prompt", lines=2)
263
+ negative_prompt_textbox = gr.Textbox(label="Negative prompt", lines=2)
264
+
265
+ with gr.Row(equal_height=False):
266
+ with gr.Column():
267
+ with gr.Row():
268
+ sampler_dropdown = gr.Dropdown(label="Sampling method", choices=list(scheduler_dict.keys()), value=list(scheduler_dict.keys())[0])
269
+ sample_step_slider = gr.Slider(label="Sampling steps", value=50, minimum=10, maximum=250, step=1)
270
+
271
+ with gr.Row():
272
+ center_crop = gr.Checkbox(label="Center Crop the Image", value=True)
273
+ width_slider = gr.Slider(label="Width", value=256, minimum=0, maximum=512, step=64)
274
+ height_slider = gr.Slider(label="Height", value=256, minimum=0, maximum=512, step=64)
275
+ with gr.Row():
276
+ txt_cfg_scale_slider = gr.Slider(label="Text CFG Scale", value=7.5, minimum=1.0, maximum=20.0, step=0.5)
277
+ img_cfg_scale_slider = gr.Slider(label="Image CFG Scale", value=1.0, minimum=1.0, maximum=20.0, step=0.5)
278
+ frame_stride = gr.Slider(label="Frame Stride", value=3, minimum=1, maximum=5, step=1)
279
+
280
+ with gr.Row():
281
+ use_frameinit = gr.Checkbox(label="Enable FrameInit", value=True)
282
+ frameinit_noise_level = gr.Slider(label="FrameInit Noise Level", value=850, minimum=1, maximum=999, step=1)
283
+
284
+ seed_textbox = gr.Textbox(label="Seed", value=-1)
285
+ seed_button = gr.Button(value="\U0001F3B2", elem_classes="toolbutton")
286
+ seed_button.click(fn=lambda: gr.Textbox(value=random.randint(1, 1e8)), inputs=[], outputs=[seed_textbox])
287
+
288
+ generate_button = gr.Button(value="Generate", variant='primary')
289
+
290
+ with gr.Column():
291
+ with gr.Row():
292
+ input_image_path = gr.Textbox(label="Input Image URL", lines=1, scale=10, info="Press Enter or the Preview button to confirm the input image.")
293
+ preview_button = gr.Button(value="Preview")
294
+
295
+ with gr.Row():
296
+ input_image = gr.Image(label="Input Image", interactive=True)
297
+ input_image.upload(fn=update_textbox_and_save_image, inputs=[input_image, height_slider, width_slider, center_crop], outputs=[input_image_path, input_image])
298
+ result_video = gr.Video(label="Generated Animation", interactive=False, autoplay=True)
299
+
 
 
 
300
  with gr.Row():
301
  batch_examples = gr.Examples(
302
  examples=EXAMPLES,
 
306
  inputs=[prompt_textbox, input_image],
307
  outputs=[prompt_textbox, input_image, input_image_path, width_slider, height_slider, center_crop, seed_textbox],
308
  )
309
+
310
  preview_button.click(fn=update_and_resize_image, inputs=[input_image_path, height_slider, width_slider, center_crop], outputs=[input_image])
311
  input_image_path.submit(fn=update_and_resize_image, inputs=[input_image_path, height_slider, width_slider, center_crop], outputs=[input_image])
312
 
 
330
  ],
331
  outputs=[result_video]
332
  )
333
+
 
334
  return demo
335
 
336