Pijush2023 commited on
Commit
5e2ba8b
·
verified ·
1 Parent(s): a5dbb66

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -2
app.py CHANGED
@@ -108,16 +108,28 @@ def generate_answer(message, choice):
108
  addresses = extract_addresses(response['output'])
109
  return response['output'], addresses
110
 
 
 
 
 
 
 
 
 
 
 
 
111
  def bot(history, choice):
112
  if not history:
113
  return history
114
- response = generate_answer(history[-1][0], choice)
115
  history[-1][1] = ""
116
  for character in response:
117
  history[-1][1] += character
118
  time.sleep(0.05)
119
  yield history
120
-
 
121
  def add_message(history, message):
122
  history.append((message, None))
123
  return history, gr.Textbox(value="", interactive=True, placeholder="Enter message or upload file...", show_label=False)
 
108
  addresses = extract_addresses(response['output'])
109
  return response['output'], addresses
110
 
111
+ # def bot(history, choice):
112
+ # if not history:
113
+ # return history
114
+ # response = generate_answer(history[-1][0], choice)
115
+ # history[-1][1] = ""
116
+ # for character in response:
117
+ # history[-1][1] += character
118
+ # time.sleep(0.05)
119
+ # yield history
120
+
121
+ # Define the bot function
122
  def bot(history, choice):
123
  if not history:
124
  return history
125
+ response, addresses = generate_answer(history[-1][0], choice)
126
  history[-1][1] = ""
127
  for character in response:
128
  history[-1][1] += character
129
  time.sleep(0.05)
130
  yield history
131
+ if addresses:
132
+ return history, addresses
133
  def add_message(history, message):
134
  history.append((message, None))
135
  return history, gr.Textbox(value="", interactive=True, placeholder="Enter message or upload file...", show_label=False)