Yassmen commited on
Commit
09307c6
·
verified ·
1 Parent(s): ccc96eb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -0
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"