Reality123b commited on
Commit
3f20358
·
verified ·
1 Parent(s): e3e3790

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -11,7 +11,7 @@ class XylariaChat:
11
 
12
  # Initialize the inference client
13
  self.client = InferenceClient(
14
- model="Qwen/Qwen-72B-Chat", # Changed model name
15
  token=self.hf_token
16
  )
17
 
@@ -200,14 +200,14 @@ Capabilities:
200
  clear = gr.Button("Clear Conversation")
201
  clear_memory = gr.Button("Clear Memory")
202
 
203
- # Load chat history from local storage on page load
 
 
204
  demo.load(
205
- fn=None,
206
- _js=load_from_local_storage_js # Pass the JS function as a string
207
- ).then(
208
- fn=lambda x: x,
209
- inputs=chatbot,
210
- outputs=chatbot
211
  )
212
 
213
  # Submit functionality with local storage save
 
11
 
12
  # Initialize the inference client
13
  self.client = InferenceClient(
14
+ model="Qwen/Qwen-72B-Chat", # Changed model name
15
  token=self.hf_token
16
  )
17
 
 
200
  clear = gr.Button("Clear Conversation")
201
  clear_memory = gr.Button("Clear Memory")
202
 
203
+ # Use `gr.State` to manage initial chatbot value and `demo.load` for initialization
204
+ initial_chat_history = gr.State([])
205
+
206
  demo.load(
207
+ fn=lambda: initial_chat_history.value,
208
+ inputs=None,
209
+ outputs=[chatbot],
210
+ _js=load_from_local_storage_js
 
 
211
  )
212
 
213
  # Submit functionality with local storage save