TejAndrewsACC commited on
Commit
1dbfd7d
·
verified ·
1 Parent(s): 2310cf9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -4
app.py CHANGED
@@ -15,9 +15,16 @@ def random_response(message, history):
15
  api_name="/chat"
16
  )
17
 
18
- # Append the new message and result to history
19
- history.append((message, result)) # Ensure the history is a list of tuples
20
- return result, history # Return both response and updated history
 
 
 
 
 
 
 
21
 
22
  # Set up Gradio chat interface
23
  demo = gr.ChatInterface(
@@ -28,7 +35,7 @@ demo = gr.ChatInterface(
28
  show_progress="full",
29
  flagging_mode="manual",
30
  editable=True,
31
- theme="TejAndrewsACC/zetaofficalthemeacc"
32
  )
33
 
34
  if __name__ == "__main__":
 
15
  api_name="/chat"
16
  )
17
 
18
+ # Convert history to Gradio's expected format if not already
19
+ if history is None:
20
+ history = []
21
+
22
+ # Append the current message and response to history as dicts
23
+ history.append({"role": "user", "message": message})
24
+ history.append({"role": "assistant", "message": result})
25
+
26
+ # Return the response and updated history in the correct format
27
+ return result, history
28
 
29
  # Set up Gradio chat interface
30
  demo = gr.ChatInterface(
 
35
  show_progress="full",
36
  flagging_mode="manual",
37
  editable=True,
38
+ theme="TejAndrewsACC/zetaofficialthemeacc"
39
  )
40
 
41
  if __name__ == "__main__":