arpit13 commited on
Commit
d0647c6
·
verified ·
1 Parent(s): 15cc869

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -34,12 +34,13 @@ def load_history():
34
  return []
35
 
36
  # Function to save conversation history
37
- def save_history(history):
38
  try:
39
  with open(CONVERSATION_FILE, "w") as file:
40
- json.dump(history, file, indent=4)
 
41
  except Exception as e:
42
- print(f"Error saving history: {e}")
43
 
44
  # Function to clear conversation history
45
  def clear_conversation_history():
@@ -230,6 +231,8 @@ with gr.Blocks(css="""
230
  hear_button = gr.Button("Hear Response")
231
  audio_output = gr.Audio(label="Bot's Voice", type="filepath", interactive=False)
232
  clear_button = gr.Button("Clear History")
 
 
233
 
234
 
235
  history_state = gr.State(load_history())
 
34
  return []
35
 
36
  # Function to save conversation history
37
+ def clear_conversation_history():
38
  try:
39
  with open(CONVERSATION_FILE, "w") as file:
40
+ json.dump([], file)
41
+ return "Conversation history cleared successfully."
42
  except Exception as e:
43
+ return f"Error clearing history: {e}"
44
 
45
  # Function to clear conversation history
46
  def clear_conversation_history():
 
231
  hear_button = gr.Button("Hear Response")
232
  audio_output = gr.Audio(label="Bot's Voice", type="filepath", interactive=False)
233
  clear_button = gr.Button("Clear History")
234
+ system_message = gr.Textbox(label="System Message", interactive=False)
235
+
236
 
237
 
238
  history_state = gr.State(load_history())