Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -67,6 +67,17 @@ def cleanup_text(text):
|
|
| 67 |
text = text.replace(src, dst)
|
| 68 |
return text
|
| 69 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
|
| 71 |
model = SpeechT5ForTextToSpeech.from_pretrained(
|
| 72 |
"Yassmen/speecht5_finetuned_english_tehnical"
|
|
|
|
| 67 |
text = text.replace(src, dst)
|
| 68 |
return text
|
| 69 |
|
| 70 |
+
def normalize_text(text):
|
| 71 |
+
# Convert to lowercase
|
| 72 |
+
text = text.lower()
|
| 73 |
+
|
| 74 |
+
# Remove punctuation (except apostrophes)
|
| 75 |
+
text = re.sub(r'[^\w\s\']', '', text)
|
| 76 |
+
|
| 77 |
+
# Remove extra whitespace
|
| 78 |
+
text = ' '.join(text.split())
|
| 79 |
+
|
| 80 |
+
return text
|
| 81 |
|
| 82 |
model = SpeechT5ForTextToSpeech.from_pretrained(
|
| 83 |
"Yassmen/speecht5_finetuned_english_tehnical"
|