fffiloni commited on
Commit
962c05e
·
verified ·
1 Parent(s): 26a2ed2
Files changed (1) hide show
  1. gradio_app.py +26 -1
gradio_app.py CHANGED
@@ -379,6 +379,31 @@ class Inferencer(object):
379
 
380
  @spaces.GPU()
381
  def gradio_infer(source_image, driven_audio):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
382
 
383
  import tempfile
384
  temp_dir = tempfile.mkdtemp()
@@ -432,5 +457,5 @@ with gr.Blocks() as demo:
432
  outputs = [output_video]
433
  )
434
 
435
- demo.launch()
436
 
 
379
 
380
  @spaces.GPU()
381
  def gradio_infer(source_image, driven_audio):
382
+ """
383
+ Generate a talking-head video from a static source image and an audio file.
384
+
385
+ This function serves as the main entry point for MCP (Machine Code Protocol) mode.
386
+ It uses a pre-trained motion and lip-sync model to animate a face image so that it
387
+ appears to speak in sync with a given audio clip. The resulting video is saved
388
+ and returned.
389
+
390
+ Args:
391
+ source_image: A path to an input image (or uploaded image) of a person's face
392
+ that will be animated.
393
+ driven_audio: A path to an audio file (or uploaded audio) that will drive the
394
+ lip-sync and head movement of the animation.
395
+
396
+ Returns:
397
+ A file path to the generated .mp4 video, which shows the input face animated
398
+ to speak and move in sync with the audio.
399
+
400
+ Workflow:
401
+ 1. Load and initialize the animation pipeline (Inferencer).
402
+ 2. Process the image and audio.
403
+ 3. Generate a talking-head animation using lip-sync and motion synthesis models.
404
+ 4. Combine generated video frames with the original audio.
405
+ 5. Return the video path to be displayed or downloaded.
406
+ """
407
 
408
  import tempfile
409
  temp_dir = tempfile.mkdtemp()
 
457
  outputs = [output_video]
458
  )
459
 
460
+ demo.launch(mcp_server=True)
461