Spaces:
Running
Running
Commit
ยท
3c41269
1
Parent(s):
f2186e3
(wip)replace space
Browse files
tts.py
CHANGED
@@ -2,6 +2,8 @@ import os
|
|
2 |
from dotenv import load_dotenv
|
3 |
import random
|
4 |
|
|
|
|
|
5 |
load_dotenv()
|
6 |
|
7 |
ZEROGPU_TOKENS = os.getenv("ZEROGPU_TOKENS", "").split(",")
|
@@ -44,7 +46,7 @@ data = {"text": "string", "provider": "string", "model": "string"}
|
|
44 |
|
45 |
def predict_index_tts(text, reference_audio_path=None):
|
46 |
from gradio_client import Client, handle_file
|
47 |
-
client = Client("
|
48 |
if reference_audio_path:
|
49 |
prompt = handle_file(reference_audio_path)
|
50 |
else:
|
@@ -92,12 +94,11 @@ def predict_cosyvoice_tts(text, reference_audio_path=None):
|
|
92 |
prompt_text = recog_result if isinstance(recog_result, str) else str(recog_result)
|
93 |
result = client.predict(
|
94 |
tts_text=text,
|
95 |
-
mode_checkbox_group="3s Voice Clone",
|
96 |
prompt_text=prompt_text,
|
97 |
prompt_wav_upload=prompt_wav,
|
98 |
prompt_wav_record=prompt_wav,
|
99 |
-
instruct_text="",
|
100 |
seed=0,
|
|
|
101 |
api_name="/generate_audio"
|
102 |
)
|
103 |
print("cosyvoice-2.0 result:", result)
|
@@ -123,7 +124,7 @@ def predict_maskgct(text, reference_audio_path=None):
|
|
123 |
|
124 |
def predict_gpt_sovits_v2(text, reference_audio_path=None):
|
125 |
from gradio_client import Client, file
|
126 |
-
client = Client("
|
127 |
if not reference_audio_path:
|
128 |
raise ValueError("GPT-SoVITS-v2 ้่ฆ reference_audio_path")
|
129 |
result = client.predict(
|
|
|
2 |
from dotenv import load_dotenv
|
3 |
import random
|
4 |
|
5 |
+
from fal_client import stream
|
6 |
+
|
7 |
load_dotenv()
|
8 |
|
9 |
ZEROGPU_TOKENS = os.getenv("ZEROGPU_TOKENS", "").split(",")
|
|
|
46 |
|
47 |
def predict_index_tts(text, reference_audio_path=None):
|
48 |
from gradio_client import Client, handle_file
|
49 |
+
client = Client("kemuriririn/IndexTTS",hf_token=os.getenv("HF_TOKEN"))
|
50 |
if reference_audio_path:
|
51 |
prompt = handle_file(reference_audio_path)
|
52 |
else:
|
|
|
94 |
prompt_text = recog_result if isinstance(recog_result, str) else str(recog_result)
|
95 |
result = client.predict(
|
96 |
tts_text=text,
|
|
|
97 |
prompt_text=prompt_text,
|
98 |
prompt_wav_upload=prompt_wav,
|
99 |
prompt_wav_record=prompt_wav,
|
|
|
100 |
seed=0,
|
101 |
+
stream=False,
|
102 |
api_name="/generate_audio"
|
103 |
)
|
104 |
print("cosyvoice-2.0 result:", result)
|
|
|
124 |
|
125 |
def predict_gpt_sovits_v2(text, reference_audio_path=None):
|
126 |
from gradio_client import Client, file
|
127 |
+
client = Client("kemuriririn/GPT-SoVITS-v2",hf_token=os.getenv("HF_TOKEN"))
|
128 |
if not reference_audio_path:
|
129 |
raise ValueError("GPT-SoVITS-v2 ้่ฆ reference_audio_path")
|
130 |
result = client.predict(
|