Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -22,8 +22,12 @@ def audio_response(text, voice="Sophia"):
|
|
22 |
Holt die Audio-Antwort von der API.
|
23 |
"""
|
24 |
url = f"https://{GET_AUDIO_API}/get-audio?text={urllib.parse.quote(text)}&voice={voice.lower()}"
|
|
|
25 |
try:
|
26 |
response = requests.get(url)
|
|
|
|
|
|
|
27 |
return response.content
|
28 |
except Exception as e:
|
29 |
return f"Ein Fehler mit der GET_AUDIO_API ist aufgetreten: {e}"
|
@@ -51,7 +55,6 @@ def bot(chat_msg, history=None, audio_tts_checkbox=False):
|
|
51 |
bot_message = completion.choices[0].message.content
|
52 |
|
53 |
if audio_tts_checkbox==True:
|
54 |
-
if audio_tts_checkbox==True:
|
55 |
print("AUDIO TTS CHECKBOY IS TURE!")
|
56 |
response_audio = audio_response(bot_message, voice="Sophia")
|
57 |
messages.append({"role": "assistant", "content": (gr.Audio(response_audio.encode()) if "Ein Fehler mit der GET_AUDIO_API" not in response_audio else bot_message)})
|
|
|
22 |
Holt die Audio-Antwort von der API.
|
23 |
"""
|
24 |
url = f"https://{GET_AUDIO_API}/get-audio?text={urllib.parse.quote(text)}&voice={voice.lower()}"
|
25 |
+
print("URL GET AUDIO API: " + url)
|
26 |
try:
|
27 |
response = requests.get(url)
|
28 |
+
|
29 |
+
print("Response: ")
|
30 |
+
print(response.content)
|
31 |
return response.content
|
32 |
except Exception as e:
|
33 |
return f"Ein Fehler mit der GET_AUDIO_API ist aufgetreten: {e}"
|
|
|
55 |
bot_message = completion.choices[0].message.content
|
56 |
|
57 |
if audio_tts_checkbox==True:
|
|
|
58 |
print("AUDIO TTS CHECKBOY IS TURE!")
|
59 |
response_audio = audio_response(bot_message, voice="Sophia")
|
60 |
messages.append({"role": "assistant", "content": (gr.Audio(response_audio.encode()) if "Ein Fehler mit der GET_AUDIO_API" not in response_audio else bot_message)})
|