RamAnanth1 commited on
Commit
73ff64a
·
1 Parent(s): 4094da1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -23,7 +23,7 @@ all_special_ids = whisper_model.tokenizer.all_special_ids
23
  transcribe_token_id = all_special_ids[-5]
24
  translate_token_id = all_special_ids[-6]
25
 
26
- def transcribe(audio):
27
  task = "translate"
28
  whisper_model.model.config.forced_decoder_ids = [[2, transcribe_token_id if task=="transcribe" else translate_token_id]]
29
  text = whisper_model(audio)["text"]
@@ -156,12 +156,12 @@ with gr.Blocks(title='Talk to chatGPT') as demo:
156
  prompt_input_audio = gr.Audio(label = 'Record Audio Input',source="microphone",type="filepath")
157
  prompt_input = gr.Textbox(lines=2, label="Input text",show_label=True)
158
  chat_history = gr.Textbox(lines=4, label="prompt", visible=False)
159
- transcribe_btn = gr.Button(value = "Transcribe").style(
160
  margin=True,
161
  rounded=(True, True, True, True),
162
  width=100
163
  )
164
- transcribe_btn.click(fn=transcribe,
165
  inputs=prompt_input_audio,
166
  outputs=prompt_input
167
  )
 
23
  transcribe_token_id = all_special_ids[-5]
24
  translate_token_id = all_special_ids[-6]
25
 
26
+ def translate(audio):
27
  task = "translate"
28
  whisper_model.model.config.forced_decoder_ids = [[2, transcribe_token_id if task=="transcribe" else translate_token_id]]
29
  text = whisper_model(audio)["text"]
 
156
  prompt_input_audio = gr.Audio(label = 'Record Audio Input',source="microphone",type="filepath")
157
  prompt_input = gr.Textbox(lines=2, label="Input text",show_label=True)
158
  chat_history = gr.Textbox(lines=4, label="prompt", visible=False)
159
+ translate_btn = gr.Button(value = "Translate").style(
160
  margin=True,
161
  rounded=(True, True, True, True),
162
  width=100
163
  )
164
+ translate_btn.click(fn=translate,
165
  inputs=prompt_input_audio,
166
  outputs=prompt_input
167
  )