ysharma HF staff commited on
Commit
a3b9251
1 Parent(s): d043fae
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -41,14 +41,16 @@ print(f"Languages for Coqui are: {LANGUAGES}")
41
 
42
  # Driver function
43
  def driver_fun(audio) :
 
 
44
  translation, lang = whisper_stt(audio) # older : transcribe, translation, lang
45
 
46
  random_val = random.randrange(0,231657)
47
  if random_val < 226657:
48
  lower_limit = random_val
49
- upper_limit = random_val + 5000
50
  else:
51
- lower_limit = random_val - 5000
52
  upper_limit = random_val
53
  print(f"lower_limit : upper_limit = {lower_limit} : {upper_limit}")
54
  dataset_subset = filtered_dataset['Joke'][lower_limit : upper_limit]
@@ -126,7 +128,7 @@ with demo:
126
  b1.click(driver_fun,inputs=[in_audio], outputs=[out_transcript, out_generated_joke, out_audio]) #out_translation_en, out_generated_text,out_generated_text_en,
127
  with gr.Row():
128
  gr.Markdown(
129
- """Model pipeline consisting of - <br>- [**Whisper**](https://github.com/openai/whisper) for Speech-to-text, <br>- [**CoquiTTS**](https://huggingface.co/coqui) for Text-To-Speech.<br>- [Sentence Transformers](https://huggingface.co/models?library=sentence-transformers&sort=downloads)<br>- Front end is built using [**Gradio Block API**](https://gradio.app/docs/#blocks).<br><be>If you want to reuse the App, simply click on the small cross button in the top right corner of your voice record panel, and then press record again! <br><br> Few Caveats:<br>1. Please note that sometimes the joke might be NSFW. Although, I have tried putting in filters to not have that experience, but they seem non-exhaustive.<br>2. Sometimes the joke might not match your theme, please bear with the limited capabilities of free open-source ML prototypes.<br>3. Much like real life, sometimes the joke might just not land, haha!<br>4. If you see the message 'Error in model inference - Run Again Please', just press the button again!
130
  """)
131
 
132
  demo.launch(enable_queue=True, debug=True)
 
41
 
42
  # Driver function
43
  def driver_fun(audio) :
44
+ #if audio is None:
45
+
46
  translation, lang = whisper_stt(audio) # older : transcribe, translation, lang
47
 
48
  random_val = random.randrange(0,231657)
49
  if random_val < 226657:
50
  lower_limit = random_val
51
+ upper_limit = random_val + 4000
52
  else:
53
+ lower_limit = random_val - 4000
54
  upper_limit = random_val
55
  print(f"lower_limit : upper_limit = {lower_limit} : {upper_limit}")
56
  dataset_subset = filtered_dataset['Joke'][lower_limit : upper_limit]
 
128
  b1.click(driver_fun,inputs=[in_audio], outputs=[out_transcript, out_generated_joke, out_audio]) #out_translation_en, out_generated_text,out_generated_text_en,
129
  with gr.Row():
130
  gr.Markdown(
131
+ """Model pipeline consisting of - <br>- [**Whisper**](https://github.com/openai/whisper) for Speech-to-text, <br>- [**CoquiTTS**](https://huggingface.co/coqui) for Text-To-Speech.<br>- [Sentence Transformers](https://huggingface.co/models?library=sentence-transformers&sort=downloads)<br>- Front end is built using [**Gradio Block API**](https://gradio.app/docs/#blocks).<br><be>If you want to reuse the App, simply click on the small cross button in the top right corner of your voice record panel, and then press record again! <br><br> Few Caveats:<br>1. Please note that sometimes the joke might be NSFW. Although, I have tried putting in filters to not have that experience, but they seem non-exhaustive.<br>2. Sometimes the joke might not match your theme, please bear with the limited capabilities of free open-source ML prototypes.<br>3. Much like real life, sometimes the joke might just not land, haha!<br>4. If you see the message 'Error in model inference - Run Again Please', just press the button again every time!
132
  """)
133
 
134
  demo.launch(enable_queue=True, debug=True)