Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -78,10 +78,15 @@ def transcribe_and_respond(audio_file, klant_profiel):
|
|
| 78 |
{"role": "user", "content": text}
|
| 79 |
],
|
| 80 |
temperature=0.7,
|
| 81 |
-
max_tokens = 100
|
|
|
|
| 82 |
)
|
| 83 |
-
ai_reply = response.choices[0].message.content
|
| 84 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
if Log_aan:
|
| 86 |
print("AI antwoordtekst :", ai_reply)
|
| 87 |
print(f"AI antwoord tekst is klaar in {time.time() - start:.2f} seconden")
|
|
|
|
| 78 |
{"role": "user", "content": text}
|
| 79 |
],
|
| 80 |
temperature=0.7,
|
| 81 |
+
max_tokens = 100,
|
| 82 |
+
stream=True
|
| 83 |
)
|
| 84 |
+
# ai_reply = response.choices[0].message.content
|
| 85 |
+
ai_reply = ""
|
| 86 |
+
for chunk in response:
|
| 87 |
+
if chunk.choices and chunk.choices[0].delta.content:
|
| 88 |
+
ai_reply += chunk.choices[0].delta.content
|
| 89 |
+
|
| 90 |
if Log_aan:
|
| 91 |
print("AI antwoordtekst :", ai_reply)
|
| 92 |
print(f"AI antwoord tekst is klaar in {time.time() - start:.2f} seconden")
|