jibay commited on
Commit ·
c90e39f
1
Parent(s): 03296be
Modif
Browse files3 unmodified lines4567891020 unmodified lines313233343536373816 unmodified lines555657585960613 unmodified linesimport osfrom flask import Flask, requestfrom flask_sock import Sock, ConnectionClosedfrom twilio.twiml.voice_response import VoiceResponse, Start, Stopfrom twilio.rest import Clientimport voskimport openai20 unmodified linesstart = Start()start.stream(url=f'wss://jibay-test.hf.space/stream')response.append(start)response.say('Bonjour je suis là pour vous aider. Quel est votre problème?', language='fr-FR')response.pause(length=60)print(f'Incoming call from {request.form["From"]}')return str(response), 200, {'Content-Type': 'text/xml'}16 unmodified linesif rec.AcceptWaveform(audio):r = json.loads(rec.Result())#print(CL + r['text'] + ' ', end='', flush=True)print('FINAL:'+r['text'] + ' ', end='', flush=True)messageChatGpt = "peux-tu me dire s'il faut appeler les secours, quelqu'un m'a ecrit ceci: \""+r['text']+"\ ?"messages.append(3 unmodified lines4567891020 unmodified lines313233343536373839404116 unmodified lines585960616263643 unmodified linesimport osfrom flask import Flask, requestfrom flask_sock import Sock, ConnectionClosedfrom twilio.twiml.voice_response import VoiceResponse, Start, Stop, Gatherfrom twilio.rest import Clientimport voskimport openai20 unmodified linesstart = Start()start.stream(url=f'wss://jibay-test.hf.space/stream')response.append(start)gather = Gather(input='speech', action='/completed')gather.say('Bonjour je suis là pour vous aider. Quel est votre problème?', language='fr-FR')response.append(gather)#response.say('Bonjour je suis là pour vous aider. Quel est votre problème?', language='fr-FR')#response.pause(length=60)print(f'Incoming call from {request.form["From"]}')return str(response), 200, {'Content-Type': 'text/xml'}16 unmodified linesif rec.AcceptWaveform(audio):r = json.loads(rec.Result())#print(CL + r['text'] + ' ', end='', flush=True)print('FINAL:'+r['text'] + '\n ', end='', flush=True)messageChatGpt = "peux-tu me dire s'il faut appeler les secours, quelqu'un m'a ecrit ceci: \""+r['text']+"\ ?"messages.append(
app.py+7-4