Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -14,6 +14,9 @@ word_tokenizer = hazm.WordTokenizer()
|
|
14 |
|
15 |
tagger_path = hf_hub_download(repo_id="gyroing/HAZM_POS_TAGGER", filename="pos_tagger.model")
|
16 |
tagger = hazm.POSTagger(model=tagger_path)
|
|
|
|
|
|
|
17 |
|
18 |
def preprocess_text(text: str) -> typing.List[typing.List[str]]:
|
19 |
"""Split/normalize text into sentences/words with hazm"""
|
@@ -43,10 +46,6 @@ def fix_words(words: typing.List[str]) -> typing.List[str]:
|
|
43 |
def synthesize_speech(text):
|
44 |
|
45 |
|
46 |
-
model_path = hf_hub_download(repo_id="gyroing/Persian-Piper-Model-gyro", filename="fa_IR-gyro-meduim.onnx")
|
47 |
-
config_path = hf_hub_download(repo_id="gyroing/Persian-Piper-Model-gyro", filename="fa_IR-gyro-meduim.onnx.json")
|
48 |
-
voice = PiperVoice.load(model_path, config_path)
|
49 |
-
|
50 |
# Create an in-memory buffer for the WAV file
|
51 |
buffer = BytesIO()
|
52 |
with wave.open(buffer, 'wb') as wav_file:
|
|
|
14 |
|
15 |
tagger_path = hf_hub_download(repo_id="gyroing/HAZM_POS_TAGGER", filename="pos_tagger.model")
|
16 |
tagger = hazm.POSTagger(model=tagger_path)
|
17 |
+
model_path = hf_hub_download(repo_id="gyroing/Persian-Piper-Model-gyro", filename="fa_IR-gyro-meduim.onnx")
|
18 |
+
config_path = hf_hub_download(repo_id="gyroing/Persian-Piper-Model-gyro", filename="fa_IR-gyro-meduim.onnx.json")
|
19 |
+
voice = PiperVoice.load(model_path, config_path)
|
20 |
|
21 |
def preprocess_text(text: str) -> typing.List[typing.List[str]]:
|
22 |
"""Split/normalize text into sentences/words with hazm"""
|
|
|
46 |
def synthesize_speech(text):
|
47 |
|
48 |
|
|
|
|
|
|
|
|
|
49 |
# Create an in-memory buffer for the WAV file
|
50 |
buffer = BytesIO()
|
51 |
with wave.open(buffer, 'wb') as wav_file:
|