Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,26 +9,16 @@ def setup():
|
|
| 9 |
return
|
| 10 |
|
| 11 |
print("Installing dependencies...")
|
| 12 |
-
|
|
|
|
|
|
|
| 13 |
|
| 14 |
print("Downloading model...")
|
| 15 |
-
os.system("git clone https://github.com/
|
| 16 |
|
| 17 |
# Download checkpoints
|
| 18 |
os.chdir("vrt")
|
| 19 |
-
os.system("
|
| 20 |
-
os.system("wget https://github.com/vinthony/video-retalking/releases/download/v0.0.1/BFM.zip -P checkpoints/")
|
| 21 |
-
os.system("unzip -q checkpoints/BFM.zip -d checkpoints/")
|
| 22 |
-
os.system("wget https://github.com/vinthony/video-retalking/releases/download/v0.0.1/DNet.pt -P checkpoints/")
|
| 23 |
-
os.system("wget https://github.com/vinthony/video-retalking/releases/download/v0.0.1/ENet.pth -P checkpoints/")
|
| 24 |
-
os.system("wget https://github.com/vinthony/video-retalking/releases/download/v0.0.1/expression.mat -P checkpoints/")
|
| 25 |
-
os.system("wget https://github.com/vinthony/video-retalking/releases/download/v0.0.1/face3d_pretrain_epoch_20.pth -P checkpoints/")
|
| 26 |
-
os.system("wget https://github.com/vinthony/video-retalking/releases/download/v0.0.1/GFPGANv1.3.pth -P checkpoints/")
|
| 27 |
-
os.system("wget https://github.com/vinthony/video-retalking/releases/download/v0.0.1/GPEN-BFR-512.pth -P checkpoints/")
|
| 28 |
-
os.system("wget https://github.com/vinthony/video-retalking/releases/download/v0.0.1/LNet.pth -P checkpoints/")
|
| 29 |
-
os.system("wget https://github.com/vinthony/video-retalking/releases/download/v0.0.1/ParseNet-latest.pth -P checkpoints/")
|
| 30 |
-
os.system("wget https://github.com/vinthony/video-retalking/releases/download/v0.0.1/RetinaFace-R50.pth -P checkpoints/")
|
| 31 |
-
os.system("wget https://github.com/vinthony/video-retalking/releases/download/v0.0.1/shape_predictor_68_face_landmarks.dat -P checkpoints/")
|
| 32 |
os.chdir("..")
|
| 33 |
|
| 34 |
Path("setup_done.txt").touch()
|
|
@@ -49,14 +39,14 @@ def generate(image, audio):
|
|
| 49 |
result = os.system(cmd)
|
| 50 |
|
| 51 |
if Path(output).exists():
|
| 52 |
-
return output, "✅
|
| 53 |
else:
|
| 54 |
-
return None, "❌ Failed to generate"
|
| 55 |
|
| 56 |
except Exception as e:
|
| 57 |
return None, f"❌ Error: {str(e)}"
|
| 58 |
|
| 59 |
-
# Simple
|
| 60 |
demo = gr.Interface(
|
| 61 |
fn=generate,
|
| 62 |
inputs=[
|
|
@@ -68,7 +58,7 @@ demo = gr.Interface(
|
|
| 68 |
gr.Textbox(label="Status")
|
| 69 |
],
|
| 70 |
title="AI Lip Sync Generator",
|
| 71 |
-
description="Upload
|
| 72 |
)
|
| 73 |
|
| 74 |
demo.launch()
|
|
|
|
| 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("..")
|
| 23 |
|
| 24 |
Path("setup_done.txt").touch()
|
|
|
|
| 39 |
result = os.system(cmd)
|
| 40 |
|
| 41 |
if Path(output).exists():
|
| 42 |
+
return output, "✅ Video generated successfully!"
|
| 43 |
else:
|
| 44 |
+
return None, "❌ Failed to generate video"
|
| 45 |
|
| 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=[
|
|
|
|
| 58 |
gr.Textbox(label="Status")
|
| 59 |
],
|
| 60 |
title="AI Lip Sync Generator",
|
| 61 |
+
description="Upload face image and audio"
|
| 62 |
)
|
| 63 |
|
| 64 |
demo.launch()
|