banao-tech commited on
Commit
56d4c3e
·
verified ·
1 Parent(s): 32e5951

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -16
app.py CHANGED
@@ -4,19 +4,15 @@ import os
4
  from pathlib import Path
5
 
6
  def setup():
7
- """One-time setup"""
8
  if Path("setup_done.txt").exists():
9
  return
10
 
11
- print("Installing dependencies...")
12
- # Install compatible versions
13
- os.system("pip install -q numpy==1.23.5")
14
- os.system("pip install -q gfpgan realesrgan")
15
 
16
- print("Downloading model...")
17
  os.system("git clone https://github.com/OpenTalker/video-retalking.git vrt")
18
 
19
- # Download checkpoints
20
  os.chdir("vrt")
21
  os.system("bash scripts/download_models.sh")
22
  os.chdir("..")
@@ -26,7 +22,7 @@ def setup():
26
 
27
  def generate(image, audio):
28
  if not image or not audio:
29
- return None, "Upload both files!"
30
 
31
  try:
32
  setup()
@@ -46,19 +42,20 @@ def generate(image, audio):
46
  except Exception as e:
47
  return None, f"❌ Error: {str(e)}"
48
 
49
- # Simple UI
50
  demo = gr.Interface(
51
  fn=generate,
52
  inputs=[
53
- gr.Image(type="filepath", label="Face Image"),
54
- gr.Audio(type="filepath", label="Audio File")
55
  ],
56
  outputs=[
57
- gr.Video(label="Result"),
58
- gr.Textbox(label="Status")
59
  ],
60
- title="AI Lip Sync Generator",
61
- description="Upload face image and audio"
62
  )
63
 
64
- demo.launch()
 
 
4
  from pathlib import Path
5
 
6
  def setup():
 
7
  if Path("setup_done.txt").exists():
8
  return
9
 
10
+ print("Setting up Video-Retalking...")
 
 
 
11
 
12
+ # Clone repo
13
  os.system("git clone https://github.com/OpenTalker/video-retalking.git vrt")
14
 
15
+ # Download models
16
  os.chdir("vrt")
17
  os.system("bash scripts/download_models.sh")
18
  os.chdir("..")
 
22
 
23
  def generate(image, audio):
24
  if not image or not audio:
25
+ return None, "Upload both image and audio!"
26
 
27
  try:
28
  setup()
 
42
  except Exception as e:
43
  return None, f"❌ Error: {str(e)}"
44
 
45
+ # Gradio Interface
46
  demo = gr.Interface(
47
  fn=generate,
48
  inputs=[
49
+ gr.Image(type="filepath", label="📷 Face Image"),
50
+ gr.Audio(type="filepath", label="🎵 Audio File")
51
  ],
52
  outputs=[
53
+ gr.Video(label="📹 Generated Video"),
54
+ gr.Textbox(label="Status", lines=2)
55
  ],
56
+ title="🎬 Video-Retalking Lip Sync",
57
+ description="Upload a face image and audio to generate lip-synced video"
58
  )
59
 
60
+ if __name__ == "__main__":
61
+ demo.launch()