CuddleBuddys commited on
Commit
51b2eae
1 Parent(s): 2260317

Update openvoice_app.py

Browse files
Files changed (1) hide show
  1. openvoice_app.py +6 -1
openvoice_app.py CHANGED
@@ -151,7 +151,7 @@ def predict(prompt, style, audio_file_pth, voice_name, customer_email, order_nam
151
  text_hint += "[ERROR] Text length limited to 200 characters. Please try shorter text.\n"
152
  return text_hint, None, None
153
 
154
- blocked_words = contains_blocked_words(prompt)
155
  if blocked_words:
156
  text_hint += f"[ERROR] Your text contains blocked words: {', '.join(blocked_words)}. Please remove them and try again.\n"
157
  return text_hint, None, None
@@ -161,6 +161,11 @@ def predict(prompt, style, audio_file_pth, voice_name, customer_email, order_nam
161
  text_hint += "[ERROR] No audio file was uploaded. Please upload a reference audio file.\n"
162
  return text_hint, None, None
163
 
 
 
 
 
 
164
  # Copy the sample audio to the samples directory
165
  try:
166
  sample_filename = f"{voice_name}_{customer_email}_sample.mp3"
 
151
  text_hint += "[ERROR] Text length limited to 200 characters. Please try shorter text.\n"
152
  return text_hint, None, None
153
 
154
+ blocked_words = get_blocked_words(prompt)
155
  if blocked_words:
156
  text_hint += f"[ERROR] Your text contains blocked words: {', '.join(blocked_words)}. Please remove them and try again.\n"
157
  return text_hint, None, None
 
161
  text_hint += "[ERROR] No audio file was uploaded. Please upload a reference audio file.\n"
162
  return text_hint, None, None
163
 
164
+ # Check if audio file was uploaded
165
+ if audio_file_pth is None:
166
+ text_hint += "[ERROR] No audio file was uploaded. Please upload a reference audio file.\n"
167
+ return text_hint, None, None
168
+
169
  # Copy the sample audio to the samples directory
170
  try:
171
  sample_filename = f"{voice_name}_{customer_email}_sample.mp3"