kh-CHEUNG commited on
Commit
a584e6d
·
verified ·
1 Parent(s): 5d3db49

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -4
app.py CHANGED
@@ -90,7 +90,7 @@ def transcribe(asr_inputs, task):
90
  raise gr.Error("No audio file submitted! Please upload or record an audio file before submitting your request.")
91
 
92
  text = asr_pl(asr_inputs, batch_size=ASR_BATCH_SIZE, generate_kwargs={"task": task}, return_timestamps=True)["text"]
93
- return [text, {"text": text, "files":[]}]
94
 
95
 
96
  """Gradio User Interface"""
@@ -125,13 +125,19 @@ transcribe_interface = gr.Interface(
125
  ],
126
  outputs=[
127
  task_output, #"text",
128
- chatbot_main_input,
129
  ],
130
  title=application_title,
131
  description=application_description,
132
  allow_flagging="never",
133
  )
134
 
 
 
 
 
 
 
 
135
 
136
  """
137
  For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
@@ -167,8 +173,8 @@ with gr.Blocks() as demo:
167
 
168
  #task_input_choice.input(fn=clear_audio_input, outputs=audio_input).then(fn=update_audio_input,
169
  task_input_choice.input(fn=update_task_input,
170
- inputs=task_input_choice,
171
- outputs=task_output
172
  )
173
 
174
 
 
90
  raise gr.Error("No audio file submitted! Please upload or record an audio file before submitting your request.")
91
 
92
  text = asr_pl(asr_inputs, batch_size=ASR_BATCH_SIZE, generate_kwargs={"task": task}, return_timestamps=True)["text"]
93
+ return text
94
 
95
 
96
  """Gradio User Interface"""
 
125
  ],
126
  outputs=[
127
  task_output, #"text",
 
128
  ],
129
  title=application_title,
130
  description=application_description,
131
  allow_flagging="never",
132
  )
133
 
134
+ def update_chatbot_main_input(updated_text):
135
+ return {"text": updated_text, "files":[]}
136
+
137
+ task_output.change(fn=update_chatbot_main_input,
138
+ inputs=task_output,
139
+ outputs=chatbot_main_input
140
+ )
141
 
142
  """
143
  For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
 
173
 
174
  #task_input_choice.input(fn=clear_audio_input, outputs=audio_input).then(fn=update_audio_input,
175
  task_input_choice.input(fn=update_task_input,
176
+ inputs=task_input_choice,
177
+ outputs=task_output
178
  )
179
 
180