rohan13 commited on
Commit
5150eb8
β€’
1 Parent(s): 50a0a9f

showing text in chatbot input and audio in output

Browse files
Files changed (1) hide show
  1. app.py +2 -3
app.py CHANGED
@@ -29,7 +29,6 @@ def run_model(text):
29
  def get_output(history, audio):
30
 
31
  txt = p(audio)["text"]
32
- history.append(( (audio, ) , txt))
33
  audio_path = 'response.wav'
34
  response = run_model(txt)
35
  # Remove all text from SOURCES: to the end of the string
@@ -39,7 +38,7 @@ def get_output(history, audio):
39
  # split audio by / and keep the last element
40
  # audio = audio.split("/")[-1]
41
  # audio = audio + ".wav"
42
- history.append(( (audio, ) , (audio_path, )))
43
  print(history)
44
  return history
45
 
@@ -58,7 +57,7 @@ with gr.Blocks() as demo:
58
  ).style(container=False)
59
 
60
  with gr.Column(scale=0.15):
61
- audio = gr.Audio(source="microphone", type="filepath").style(container=False)
62
 
63
  txt.submit(add_text, [chatbot, txt], [chatbot, txt], postprocess=False).then(
64
  bot, chatbot, chatbot
 
29
  def get_output(history, audio):
30
 
31
  txt = p(audio)["text"]
 
32
  audio_path = 'response.wav'
33
  response = run_model(txt)
34
  # Remove all text from SOURCES: to the end of the string
 
38
  # split audio by / and keep the last element
39
  # audio = audio.split("/")[-1]
40
  # audio = audio + ".wav"
41
+ history.append(( txt , (audio_path, )))
42
  print(history)
43
  return history
44
 
 
57
  ).style(container=False)
58
 
59
  with gr.Column(scale=0.15):
60
+ audio = gr.Audio(source="microphone", type="filepath", suffix=".wav").style(container=False)
61
 
62
  txt.submit(add_text, [chatbot, txt], [chatbot, txt], postprocess=False).then(
63
  bot, chatbot, chatbot