pszemraj commited on
Commit
f0a2b13
1 Parent(s): 52e2b32

fix session

Browse files
Files changed (1) hide show
  1. app.py +3 -8
app.py CHANGED
@@ -99,30 +99,25 @@ def ask_gpt(message: str, sender: str = ""):
99
 
100
  return bot_resp
101
 
102
-
103
  def chat(first_and_last_name, message):
104
  """
105
  chat - helper function that makes the whole gradio thing work.
106
-
107
  Args:
108
  first_and_last_name (str or None): [speaker of the prompt, if provided]
109
  message (str): [description]
110
-
111
  Returns:
112
  [str]: [returns an html string to display]
113
  """
114
- history = session.get("my_state") or []
115
  response = ask_gpt(message, sender=first_and_last_name)
116
  history.append((f"{first_and_last_name}: " + message, " GPT-Model: " + response)) #+ " [end] "))
117
- session["my_state"] = history
118
- session.modified = True
119
  #html = "<div class='chatbot'>"
120
  #for user_msg, resp_msg in history:
121
  # html += f"<div class='user_msg'>{user_msg}</div>"
122
  # html += f"<div class='resp_msg' style='color: black'>{resp_msg}</div>"
123
  #html += "</div>"
124
- return response
125
-
126
 
127
  def get_parser():
128
  """
 
99
 
100
  return bot_resp
101
 
 
102
  def chat(first_and_last_name, message):
103
  """
104
  chat - helper function that makes the whole gradio thing work.
 
105
  Args:
106
  first_and_last_name (str or None): [speaker of the prompt, if provided]
107
  message (str): [description]
 
108
  Returns:
109
  [str]: [returns an html string to display]
110
  """
111
+ history = []
112
  response = ask_gpt(message, sender=first_and_last_name)
113
  history.append((f"{first_and_last_name}: " + message, " GPT-Model: " + response)) #+ " [end] "))
114
+
 
115
  #html = "<div class='chatbot'>"
116
  #for user_msg, resp_msg in history:
117
  # html += f"<div class='user_msg'>{user_msg}</div>"
118
  # html += f"<div class='resp_msg' style='color: black'>{resp_msg}</div>"
119
  #html += "</div>"
120
+ return history
 
121
 
122
  def get_parser():
123
  """