PhilSpiel commited on
Commit
45584fe
·
1 Parent(s): ee92f63

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
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.extend(current_exchange + [{"role": "assistant", "content": message_content}])
 
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