Spaces:
Running
on
Zero
Running
on
Zero
Commit
·
55fd1c7
1
Parent(s):
d7016b3
remove versions for some reqs
Browse files- app.py +20 -0
- requirements.txt +6 -6
app.py
CHANGED
|
@@ -4,9 +4,29 @@ import os
|
|
| 4 |
from functools import partial
|
| 5 |
import gradio as gr
|
| 6 |
import traceback
|
|
|
|
| 7 |
from tts.infer_cli import MegaTTS3DiTInfer, convert_to_wav, cut_wav
|
| 8 |
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
def model_worker(input_queue, output_queue, device_id):
|
| 11 |
device = None
|
| 12 |
if device_id is not None:
|
|
|
|
| 4 |
from functools import partial
|
| 5 |
import gradio as gr
|
| 6 |
import traceback
|
| 7 |
+
from huggingface_hub import hf_hub_download, snapshot_download
|
| 8 |
from tts.infer_cli import MegaTTS3DiTInfer, convert_to_wav, cut_wav
|
| 9 |
|
| 10 |
|
| 11 |
+
def download_weights():
|
| 12 |
+
"""Download model weights from HuggingFace if not already present."""
|
| 13 |
+
repo_id = "mrfakename/MegaTTS3-VoiceCloning"
|
| 14 |
+
weights_dir = "weights"
|
| 15 |
+
|
| 16 |
+
if not os.path.exists(weights_dir):
|
| 17 |
+
print("Downloading model weights from HuggingFace...")
|
| 18 |
+
snapshot_download(
|
| 19 |
+
repo_id=repo_id,
|
| 20 |
+
local_dir=weights_dir,
|
| 21 |
+
local_dir_use_symlinks=False
|
| 22 |
+
)
|
| 23 |
+
print("Model weights downloaded successfully!")
|
| 24 |
+
else:
|
| 25 |
+
print("Model weights already exist.")
|
| 26 |
+
|
| 27 |
+
return weights_dir
|
| 28 |
+
|
| 29 |
+
|
| 30 |
def model_worker(input_queue, output_queue, device_id):
|
| 31 |
device = None
|
| 32 |
if device_id is not None:
|
requirements.txt
CHANGED
|
@@ -1,9 +1,9 @@
|
|
| 1 |
-
torch
|
| 2 |
-
torchaudio
|
| 3 |
-
numpy
|
| 4 |
-
setproctitle
|
| 5 |
-
attrdict
|
| 6 |
-
librosa
|
| 7 |
langdetect==1.0.9
|
| 8 |
pydub==0.25.1
|
| 9 |
pyloudnorm==0.1.1
|
|
|
|
| 1 |
+
torch
|
| 2 |
+
torchaudio
|
| 3 |
+
numpy
|
| 4 |
+
setproctitle
|
| 5 |
+
attrdict
|
| 6 |
+
librosa
|
| 7 |
langdetect==1.0.9
|
| 8 |
pydub==0.25.1
|
| 9 |
pyloudnorm==0.1.1
|