Update
Browse files102 unmodified lines1031041051061071081091101117 unmodified lines11912012112212312412546 unmodified lines17217317417517617717817918018118218318418511 unmodified lines197198199200102 unmodified linesself.all_output_data = audio_arrayelse:self.all_output_data = np.concatenate((self.all_output_data, audio_array))while self.all_output_data.shape[-1] >= self.output_frame_size:yield (self.output_sample_rate,self.all_output_data[:self.output_frame_size].reshape(1, -1))self.all_output_data = self.all_output_data[self.output_frame_size:]7 unmodified linestry:message = self.ws.recv(timeout=5)msg = json.loads(message)if 'serverContent' in msg:content = msg['serverContent'].get('modelTurn', {})yield from self._process_server_content(content)46 unmodified lines<p>Speak with Gemini using real-time audio streaming</p></div>""")webrtc = WebRTC(label="Conversation",modality="audio",mode="send-receive",rtc_configuration=get_twilio_turn_credentials())webrtc.stream(GeminiHandler(),inputs=[webrtc],11 unmodified linesreturn chat.demo# This is what will be imported by app.pydemo = demo()102 unmodified lines1031041051061071081091101117 unmodified lines11912012112212312412546 unmodified lines17217317417517617717817918018118218318418511 unmodified lines197198199200201202203102 unmodified linesself.all_output_data = audio_arrayelse:self.all_output_data = np.concatenate((self.all_output_data, audio_array))while self.all_output_data.shape[-1] >= self.output_frame_size:yield (self.output_sample_rate,self.all_output_data[:self.output_frame_size].reshape(1, -1))self.all_output_data = self.all_output_data[self.output_frame_size:]7 unmodified linestry:message = self.ws.recv(timeout=5)msg = json.loads(message)if 'serverContent' in msg:content = msg['serverContent'].get('modelTurn', {})yield from self._process_server_content(content)46 unmodified lines<p>Speak with Gemini using real-time audio streaming</p></div>""")webrtc = WebRTC(label="Conversation",modality="audio",mode="send-receive",rtc_configuration=get_twilio_turn_credentials())webrtc.stream(GeminiHandler(),inputs=[webrtc],11 unmodified linesreturn chat.demo# This is what will be imported by app.pydemo = demo()if __name__ == "__main__":demo.launch(server_name="0.0.0.0")
app_gemini_voice.py+9-6