jjjimim commited on
Commit
291ba5c
·
verified ·
1 Parent(s): d63c580

Upload 3 files

Browse files
Files changed (3) hide show
  1. README.md +25 -13
  2. app.py +32 -0
  3. requirements.txt +6 -0
README.md CHANGED
@@ -1,13 +1,25 @@
1
- ---
2
- title: Bettervideos
3
- emoji: 💻
4
- colorFrom: indigo
5
- colorTo: purple
6
- sdk: gradio
7
- sdk_version: 5.38.2
8
- app_file: app.py
9
- pinned: false
10
- short_description: 'video vidoe '
11
- ---
12
-
13
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Faceless Video Generator (Free)
2
+
3
+ This is a minimal talking avatar video generator app using open-source models.
4
+
5
+ ## Setup
6
+
7
+ 1. Install dependencies:
8
+ ```bash
9
+ pip install -r requirements.txt
10
+ ```
11
+
12
+ 2. Run the app:
13
+ ```bash
14
+ python app.py
15
+ ```
16
+
17
+ 3. Open the URL displayed in your terminal in your browser.
18
+
19
+ 4. Upload your avatar image and enter text to generate talking avatar videos.
20
+
21
+ ## Notes
22
+
23
+ - This uses the First Order Motion Model (https://github.com/AliaksandrSiarohin/first-order-model) for animation.
24
+ - Coqui TTS is used for text-to-speech.
25
+ - Model weights will be downloaded automatically on first run.
app.py ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from huggingface_hub import snapshot_download
2
+ import gradio as gr
3
+ import subprocess
4
+ import os
5
+ import uuid
6
+
7
+ def setup_models():
8
+ if not os.path.exists("checkpoints"):
9
+ print("Downloading model...")
10
+ snapshot_download(repo_id="deepinsight/first-order-model", local_dir="checkpoints")
11
+
12
+ setup_models()
13
+
14
+ def generate(text, image):
15
+ session = str(uuid.uuid4())[:8]
16
+ os.makedirs(f"results/{session}", exist_ok=True)
17
+ image_path = f"results/{session}/avatar.jpg"
18
+ image.save(image_path)
19
+ audio_path = f"results/{session}/audio.wav"
20
+ tts_cmd = f'tts --text "{text}" --out_path {audio_path}'
21
+ subprocess.run(tts_cmd, shell=True, check=True)
22
+ video_cmd = f'python checkpoints/inference.py --driven_audio {audio_path} --source_image {image_path} --result_dir results/{session}'
23
+ subprocess.run(video_cmd, shell=True, check=True)
24
+ return f"results/{session}/video.mp4"
25
+
26
+ gr.Interface(
27
+ fn=generate,
28
+ inputs=[gr.Textbox(label="Script"), gr.Image(label="Avatar Image", type="pil")],
29
+ outputs=gr.Video(label="Generated Video"),
30
+ title="Faceless Video Generator (Free)",
31
+ description="Type your message + upload an image. Get a talking avatar video!"
32
+ ).launch()
requirements.txt ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ gradio
2
+ huggingface_hub
3
+ tts
4
+ torch
5
+ opencv-python
6
+ numpy