Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -6,6 +6,16 @@ from TTS.api import TTS
|
|
6 |
import torch
|
7 |
import assemblyai as aai
|
8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
# Download necessary models if not already present
|
10 |
model_files = {
|
11 |
"wav2lip.pth": "https://github.com/justinjohn0306/Wav2Lip/releases/download/models/wav2lip.pth",
|
@@ -15,18 +25,6 @@ model_files = {
|
|
15 |
"s3fd.pth": "https://www.adrianbulat.com/downloads/python-fan/s3fd-619a316812.pth"
|
16 |
}
|
17 |
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
# Confirm licensing or agreement to terms
|
22 |
-
confirm_license = input("Have you purchased a commercial license from Coqui or agree to the terms of the non-commercial CPML? (y/n): ") or "y"
|
23 |
-
|
24 |
-
# Initialize TTS model
|
25 |
-
tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2", gpu=True)
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
for filename, url in model_files.items():
|
31 |
file_path = os.path.join("checkpoints" if "pth" in filename else "face_detection", filename)
|
32 |
if not os.path.exists(file_path):
|
@@ -35,13 +33,8 @@ for filename, url in model_files.items():
|
|
35 |
with open(file_path, 'wb') as f:
|
36 |
f.write(r.content)
|
37 |
|
38 |
-
|
39 |
-
|
40 |
-
# # Confirm licensing or agreement to terms
|
41 |
-
# confirm_license = input("Have you purchased a commercial license from Coqui or agree to the terms of the non-commercial CPML? (y/n): ") or "y"
|
42 |
-
|
43 |
-
# # Initialize TTS model
|
44 |
-
# tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2", gpu=True)
|
45 |
|
46 |
# Translation class
|
47 |
class translation:
|
|
|
6 |
import torch
|
7 |
import assemblyai as aai
|
8 |
|
9 |
+
# Handle interactive prompts programmatically
|
10 |
+
import builtins
|
11 |
+
|
12 |
+
def mock_input(prompt):
|
13 |
+
if "license" in prompt.lower():
|
14 |
+
return "y" # Automatically agree to terms
|
15 |
+
return ""
|
16 |
+
|
17 |
+
builtins.input = mock_input
|
18 |
+
|
19 |
# Download necessary models if not already present
|
20 |
model_files = {
|
21 |
"wav2lip.pth": "https://github.com/justinjohn0306/Wav2Lip/releases/download/models/wav2lip.pth",
|
|
|
25 |
"s3fd.pth": "https://www.adrianbulat.com/downloads/python-fan/s3fd-619a316812.pth"
|
26 |
}
|
27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
for filename, url in model_files.items():
|
29 |
file_path = os.path.join("checkpoints" if "pth" in filename else "face_detection", filename)
|
30 |
if not os.path.exists(file_path):
|
|
|
33 |
with open(file_path, 'wb') as f:
|
34 |
f.write(r.content)
|
35 |
|
36 |
+
# Initialize TTS model
|
37 |
+
tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2", gpu=True)
|
|
|
|
|
|
|
|
|
|
|
38 |
|
39 |
# Translation class
|
40 |
class translation:
|