ysharma HF staff commited on
Commit
a443183
1 Parent(s): 4a5c5dd
Files changed (1) hide show
  1. app.py +2 -22
app.py CHANGED
@@ -1,6 +1,5 @@
1
  import os
2
- #os.system("pip install git+https://github.com/openai/whisper.git")
3
- #os.system("pip install neon-tts-plugin-coqui==0.6.0")
4
  import gradio as gr
5
  #import whisper
6
  import requests
@@ -24,26 +23,10 @@ def query(payload):
24
  response = requests.post(API_URL, headers=headers, json=payload)
25
  return response.json()
26
 
27
-
28
- # Language common in both the multilingual models - English, Chinese, Spanish, and French etc
29
- # Model 1: Whisper: Speech-to-text
30
- #model = whisper.load_model("base")
31
-
32
-
33
- #Model 2: Text-to-Speech
34
- #LANGUAGES = list(CoquiTTS.langs.keys())
35
- #coquiTTS = CoquiTTS()
36
- #Languages for Coqui are: ['en', 'es', 'fr', 'de', 'pl', 'uk', 'ro', 'hu', 'el', 'bg', 'nl', 'fi', 'sl', 'lv', 'ga']
37
-
38
 
39
  # Driver function
40
  def driver_fun(text) :
41
  print("*********** Inside Driver ************")
42
- #if (text == 'dummy') and (audio is not None) :
43
- # print(f"Audio is {audio}")
44
- # translation, lang = whisper_stt(audio)
45
- #else:
46
- # translation = text
47
 
48
  random_val = random.randrange(0,231657)
49
  if random_val < 226657:
@@ -65,7 +48,6 @@ def driver_fun(text) :
65
  joke = dataset_subset[indx_score]
66
  print(f"Joke is : {joke}")
67
 
68
- #speech = tts(joke, 'en')
69
  return joke
70
 
71
  demo = gr.Blocks()
@@ -76,13 +58,11 @@ with demo:
76
  """)
77
  with gr.Row():
78
  with gr.Column():
79
- #in_audio = gr.Audio(source="microphone", type="filepath", label='Record your voice command here in English -') #type='filepath'
80
  in_text = gr.Textbox(label= 'Enter a theme or context for a joke')
81
  b1 = gr.Button("Get a Joke")
82
 
83
  with gr.Column():
84
- #in_text = gr.Textbox(label='Or enter any text here..', value='dummy')
85
- #out_audio = gr.Audio(label='Audio response form CoquiTTS')
86
  out_generated_joke = gr.Textbox(label= 'Joke returned! ')
87
 
88
  b1.click(driver_fun,inputs=[in_text], outputs=[out_generated_joke]) #out_translation_en, out_generated_text,out_generated_text_en,
 
1
  import os
2
+
 
3
  import gradio as gr
4
  #import whisper
5
  import requests
 
23
  response = requests.post(API_URL, headers=headers, json=payload)
24
  return response.json()
25
 
 
 
 
 
 
 
 
 
 
 
 
26
 
27
  # Driver function
28
  def driver_fun(text) :
29
  print("*********** Inside Driver ************")
 
 
 
 
 
30
 
31
  random_val = random.randrange(0,231657)
32
  if random_val < 226657:
 
48
  joke = dataset_subset[indx_score]
49
  print(f"Joke is : {joke}")
50
 
 
51
  return joke
52
 
53
  demo = gr.Blocks()
 
58
  """)
59
  with gr.Row():
60
  with gr.Column():
61
+
62
  in_text = gr.Textbox(label= 'Enter a theme or context for a joke')
63
  b1 = gr.Button("Get a Joke")
64
 
65
  with gr.Column():
 
 
66
  out_generated_joke = gr.Textbox(label= 'Joke returned! ')
67
 
68
  b1.click(driver_fun,inputs=[in_text], outputs=[out_generated_joke]) #out_translation_en, out_generated_text,out_generated_text_en,