Update app.py
Browse files
app.py
CHANGED
|
@@ -36,7 +36,8 @@ def generate_speech(name, input_text):
|
|
| 36 |
|
| 37 |
# Update the conversation history with the current exchange
|
| 38 |
# This ensures the full history is preserved for the next call but only the latest messages are sent to TTS
|
| 39 |
-
history_openai_format.
|
|
|
|
| 40 |
|
| 41 |
# Use ElevenLabs TTS API settings and request for the latest assistant response
|
| 42 |
url = "https://api.elevenlabs.io/v1/text-to-speech/eIH76iW9yjOWnOKIkd6y/stream"
|
|
@@ -83,4 +84,7 @@ iface = gr.Interface(
|
|
| 83 |
)
|
| 84 |
|
| 85 |
# Launch the interface
|
| 86 |
-
iface.launch(show_api=False)
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
# Update the conversation history with the current exchange
|
| 38 |
# This ensures the full history is preserved for the next call but only the latest messages are sent to TTS
|
| 39 |
+
history_openai_format.append({"role": "assistant", "content": message_content})
|
| 40 |
+
#history_openai_format.extend(current_exchange + [{"role": "assistant", "content": message_content}])
|
| 41 |
|
| 42 |
# Use ElevenLabs TTS API settings and request for the latest assistant response
|
| 43 |
url = "https://api.elevenlabs.io/v1/text-to-speech/eIH76iW9yjOWnOKIkd6y/stream"
|
|
|
|
| 84 |
)
|
| 85 |
|
| 86 |
# Launch the interface
|
| 87 |
+
iface.launch(show_api=False)
|
| 88 |
+
|
| 89 |
+
# Clear the conversation history when the interface is closed or interrupted
|
| 90 |
+
history_openai_format.clear() # This line will reset the history when the script is stopped
|