mou3az commited on
Commit
3e5ab6b
1 Parent(s): 5a2b8e5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -12
app.py CHANGED
@@ -197,18 +197,18 @@ def user3(user_message, history, file_path):
197
  combined_message = f"{file_path}\n{user_message}"
198
  return "", history + [[combined_message, None]], file_path
199
 
200
- messages1 = [
201
  SystemMessage(content="You are a helpful assistant."),
202
  HumanMessage(content="Hi AI, how are you today?"),
203
  AIMessage(content="I'm great thank you. How can I help you?")]
204
- messages2 = messages1.copy()
205
- messages3 = messages1.copy()
206
- messages4 = messages1.copy()
207
- messages5 = messages1.copy()
208
- messages6 = messages1.copy()
 
209
 
210
  def Chat_Message(history):
211
- global messages1
212
 
213
  message=HumanMessage(content=history[-1][0])
214
  messages1.append(message)
@@ -225,7 +225,6 @@ def Chat_Message(history):
225
  yield history
226
 
227
  def Internet_Search(history):
228
- global messages2
229
 
230
  message=history[-1][0]
231
 
@@ -261,7 +260,6 @@ def Internet_Search(history):
261
  yield history
262
 
263
  def Chart_Generator(history):
264
- global messages3
265
 
266
  message = history[-1][0]
267
  if '#chart' in message:
@@ -305,7 +303,6 @@ def Chart_Generator(history):
305
  yield history
306
 
307
  def Link_Scratch(history):
308
- global messages4
309
 
310
  combined_message = history[-1][0]
311
 
@@ -368,7 +365,6 @@ def display_file_name(file):
368
  raise gr.Error("( Supported File Types Only : PDF , CSV , TXT , DOCX , PPTX , XLSX , JSON , HTML , XML )")
369
 
370
  def File_Interact(history,filepath):
371
- global messages5
372
 
373
  combined_message = history[-1][0]
374
 
@@ -413,7 +409,6 @@ def File_Interact(history,filepath):
413
  yield history
414
 
415
  def Explore_WebSite(history):
416
- global messages6
417
 
418
  message=history[-1][0]
419
 
 
197
  combined_message = f"{file_path}\n{user_message}"
198
  return "", history + [[combined_message, None]], file_path
199
 
200
+ messages1_state = [
201
  SystemMessage(content="You are a helpful assistant."),
202
  HumanMessage(content="Hi AI, how are you today?"),
203
  AIMessage(content="I'm great thank you. How can I help you?")]
204
+ messages1 = gr.State(messages1_state)
205
+ messages2 = gr.State(messages1_state)
206
+ messages3 = gr.State(messages1_state)
207
+ messages4 = gr.State(messages1_state)
208
+ messages5 = gr.State(messages1_state)
209
+ messages6 = gr.State(messages1_state)
210
 
211
  def Chat_Message(history):
 
212
 
213
  message=HumanMessage(content=history[-1][0])
214
  messages1.append(message)
 
225
  yield history
226
 
227
  def Internet_Search(history):
 
228
 
229
  message=history[-1][0]
230
 
 
260
  yield history
261
 
262
  def Chart_Generator(history):
 
263
 
264
  message = history[-1][0]
265
  if '#chart' in message:
 
303
  yield history
304
 
305
  def Link_Scratch(history):
 
306
 
307
  combined_message = history[-1][0]
308
 
 
365
  raise gr.Error("( Supported File Types Only : PDF , CSV , TXT , DOCX , PPTX , XLSX , JSON , HTML , XML )")
366
 
367
  def File_Interact(history,filepath):
 
368
 
369
  combined_message = history[-1][0]
370
 
 
409
  yield history
410
 
411
  def Explore_WebSite(history):
 
412
 
413
  message=history[-1][0]
414