Spaces:
Running
Running
Commit
โข
99db302
1
Parent(s):
6f1440b
Update app.py
Browse files
app.py
CHANGED
@@ -30,9 +30,16 @@ def belarusify_russian_text(text: str):
|
|
30 |
text = text.replace("ั", "ัั")
|
31 |
return text
|
32 |
|
33 |
-
|
34 |
def tts(text: str):
|
35 |
text = belarusify_russian_text(text)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
best_model_path = hf_hub_download(repo_id=REPO_ID, filename="model.pth")
|
37 |
config_path = hf_hub_download(repo_id=REPO_ID, filename="config.json")
|
38 |
vocoder_path = hf_hub_download(repo_id=REPO_ID, filename="vocoder.pth")
|
|
|
30 |
text = text.replace("ั", "ัั")
|
31 |
return text
|
32 |
|
33 |
+
import requests
|
34 |
def tts(text: str):
|
35 |
text = belarusify_russian_text(text)
|
36 |
+
# Sending a request to the fonemizer
|
37 |
+
response = requests.post("http://fonemizer.nikuchin.fun/processText",
|
38 |
+
data=text,
|
39 |
+
headers={'Content-Type': 'text/plain'})
|
40 |
+
if response.status_code != 200:
|
41 |
+
raise Exception(f"Request to fonemizer failed with status code {response.status_code}")
|
42 |
+
|
43 |
best_model_path = hf_hub_download(repo_id=REPO_ID, filename="model.pth")
|
44 |
config_path = hf_hub_download(repo_id=REPO_ID, filename="config.json")
|
45 |
vocoder_path = hf_hub_download(repo_id=REPO_ID, filename="vocoder.pth")
|