LouisLi commited on
Commit
6e6d193
·
verified ·
1 Parent(s): 479ade0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +83 -0
app.py CHANGED
@@ -1356,7 +1356,90 @@ def create_ui():
1356
  ############# this part is for text to video #############
1357
  ###############################################################################
1358
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1359
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1360
 
1361
 
1362
  ###############################################################################
 
1356
  ############# this part is for text to video #############
1357
  ###############################################################################
1358
 
1359
+ with gr.Row(variant="panel") as text2video_model:
1360
+ with gr.Group():
1361
+ with gr.Row():
1362
+ prompt = gr.Textbox(
1363
+ label='Prompt'
1364
+ )
1365
+ with gr.Row():
1366
+ select_base = gr.Dropdown(
1367
+ label='Base model',
1368
+ choices=[
1369
+ "Cartoon",
1370
+ "Realistic",
1371
+ "3d",
1372
+ "Anime",
1373
+ ],
1374
+ value=base_loaded,
1375
+ interactive=True
1376
+ )
1377
+ select_motion = gr.Dropdown(
1378
+ label='Motion',
1379
+ choices=[
1380
+ ("Default", ""),
1381
+ ("Zoom in", "guoyww/animatediff-motion-lora-zoom-in"),
1382
+ ("Zoom out", "guoyww/animatediff-motion-lora-zoom-out"),
1383
+ ("Tilt up", "guoyww/animatediff-motion-lora-tilt-up"),
1384
+ ("Tilt down", "guoyww/animatediff-motion-lora-tilt-down"),
1385
+ ("Pan left", "guoyww/animatediff-motion-lora-pan-left"),
1386
+ ("Pan right", "guoyww/animatediff-motion-lora-pan-right"),
1387
+ ("Roll left", "guoyww/animatediff-motion-lora-rolling-anticlockwise"),
1388
+ ("Roll right", "guoyww/animatediff-motion-lora-rolling-clockwise"),
1389
+ ],
1390
+ value="guoyww/animatediff-motion-lora-zoom-in",
1391
+ interactive=True
1392
+ )
1393
+ select_step = gr.Dropdown(
1394
+ label='Inference steps',
1395
+ choices=[
1396
+ ('1-Step', 1),
1397
+ ('2-Step', 2),
1398
+ ('4-Step', 4),
1399
+ ('8-Step', 8),
1400
+ ],
1401
+ value=4,
1402
+ interactive=True
1403
+ )
1404
+ submit = gr.Button(
1405
+ scale=1,
1406
+ variant='primary'
1407
+ )
1408
+ video = gr.Video(
1409
+ label='AnimateDiff-Lightning',
1410
+ autoplay=True,
1411
+ height=512,
1412
+ width=512,
1413
+ elem_id="video_output"
1414
+ )
1415
+
1416
+ prompt.submit(
1417
+ fn=generate_image,
1418
+ inputs=[prompt, select_base, select_motion, select_step],
1419
+ outputs=video,
1420
+ )
1421
+ submit.click(
1422
+ fn=generate_image,
1423
+ inputs=[prompt, select_base, select_motion, select_step],
1424
+ outputs=video,
1425
+ )
1426
 
1427
+ gr.Examples(
1428
+ examples=[
1429
+ ["Focus: Eiffel Tower (Animate: Clouds moving)"], #Atmosphere Movement Example
1430
+ ["Focus: Trees In forest (Animate: Lion running)"], #Object Movement Example
1431
+ ["Focus: Astronaut in Space"], #Normal
1432
+ ["Focus: Group of Birds in sky (Animate: Birds Moving) (Shot From distance)"], #Camera distance
1433
+ ["Focus: Statue of liberty (Shot from Drone) (Animate: Drone coming toward statue)"], #Camera Movement
1434
+ ["Focus: Panda in Forest (Animate: Drinking Tea)"], #Doing Something
1435
+ ["Focus: Kids Playing (Season: Winter)"], #Atmosphere or Season
1436
+ {"Focus: Cars in Street (Season: Rain, Daytime) (Shot from Distance) (Movement: Cars running)"} #Mixture
1437
+ ],
1438
+ fn=generate_image,
1439
+ inputs=[prompt],
1440
+ outputs=video,
1441
+ cache_examples=True,
1442
+ )
1443
 
1444
 
1445
  ###############################################################################