freddyaboulton HF staff commited on
Commit
3ada2e5
1 Parent(s): d57efb9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -2
app.py CHANGED
@@ -72,6 +72,23 @@ def transcribe(audio: tuple[int, np.ndarray], transformers_convo: list[dict], gr
72
 
73
 
74
  with gr.Blocks() as demo:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
  transformers_convo = gr.State(value=[])
76
  with gr.Row():
77
  with gr.Column():
@@ -84,8 +101,8 @@ with gr.Blocks() as demo:
84
  with gr.Column():
85
  transcript = gr.Chatbot(label="transcript", type="messages")
86
 
87
- audio.stream(ReplyOnPause(transcribe), inputs=[audio, transformers_convo, transcript], outputs=[audio])
88
- audio.on_additional_outputs(lambda s,a: (s,a), outputs=[transformers_convo, transcript])
89
 
90
  if __name__ == "__main__":
91
  demo.launch()
 
72
 
73
 
74
  with gr.Blocks() as demo:
75
+ gr.HTML(
76
+ """
77
+ <h1 style='text-align: center'>
78
+ Talk to Qwen2Audio (Powered by WebRTC ⚡️)
79
+ </h1>
80
+ <p style='text-align: center'>
81
+ Once you grant access to your microphone, you can talk naturally to Qwen2Audio.
82
+ When you stop talking, the audio will be sent for processing.
83
+ </p>
84
+ <p style='text-align: center'>
85
+ There will be some delay in responding due to acquiring the ZeroGPU resources.
86
+ </p>
87
+ <p style='text-align: center'>
88
+ Each conversation is limited to 90 seconds. Once the time limit is up you can rejoin the conversation.
89
+ </p>
90
+ """
91
+ )
92
  transformers_convo = gr.State(value=[])
93
  with gr.Row():
94
  with gr.Column():
 
101
  with gr.Column():
102
  transcript = gr.Chatbot(label="transcript", type="messages")
103
 
104
+ audio.stream(ReplyOnPause(yield_audio), inputs=[audio], outputs=[audio])
105
+ audio.on_additional_outputs(respond, outputs=[transformers_convo, transcript])
106
 
107
  if __name__ == "__main__":
108
  demo.launch()