refactor: simplify text validation

#2
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -208,7 +208,7 @@ def transcribe_and_stream(inputs, model_name="groq_whisper", show_info="show_inf
208
 
209
 
210
  def aya_speech_text_response(text):
211
- if text is not None and text!="":
212
  stream = audio_response_client.chat_stream(message=text,preamble=AUDIO_RESPONSE_PREAMBLE, model=AYA_MODEL_NAME)
213
  output = ""
214
 
@@ -236,7 +236,7 @@ def clean_text(text, remove_bullets=False, remove_newline=False):
236
  def convert_text_to_speech(text, language="english"):
237
 
238
  # do language detection to determine voice of speech response
239
- if text is not None and text!="":
240
  # clean text before doing language detection
241
  cleaned_text = clean_text(text, remove_bullets=True, remove_newline=True)
242
  text_lang_code = predict_language(cleaned_text)
 
208
 
209
 
210
  def aya_speech_text_response(text):
211
+ if text:
212
  stream = audio_response_client.chat_stream(message=text,preamble=AUDIO_RESPONSE_PREAMBLE, model=AYA_MODEL_NAME)
213
  output = ""
214
 
 
236
  def convert_text_to_speech(text, language="english"):
237
 
238
  # do language detection to determine voice of speech response
239
+ if text:
240
  # clean text before doing language detection
241
  cleaned_text = clean_text(text, remove_bullets=True, remove_newline=True)
242
  text_lang_code = predict_language(cleaned_text)