Pclanglais commited on
Commit
98345c4
1 Parent(s): c4ea8b5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -160,7 +160,7 @@ def predict(message, history):
160
  if new_token != '<':
161
  partial_message += new_token
162
  yield partial_message
163
- return messages
164
 
165
  # Define the Gradio interface
166
  title = "Tchap"
@@ -172,11 +172,12 @@ examples = [
172
  ]
173
  ]
174
 
175
- demo = gr.Blocks()
176
-
177
  with gr.Blocks() as demo:
178
- gr.ChatInterface(predict)
179
- gr.HTML("""<h3 style="text-align:center">Sources</h3><p>""" + source_text + """</p>""")
 
 
180
 
181
  if __name__ == "__main__":
182
  demo.queue().launch()
 
160
  if new_token != '<':
161
  partial_message += new_token
162
  yield partial_message
163
+ return messages, source_text
164
 
165
  # Define the Gradio interface
166
  title = "Tchap"
 
172
  ]
173
  ]
174
 
175
+ # Define the Gradio interface
 
176
  with gr.Blocks() as demo:
177
+ with gr.Row():
178
+ chat_box = gr.ChatInterface(fn=predict, inputs=[gr.Text(), gr.Dataframe()])
179
+ source_display = gr.HTML()
180
+ chat_box.change(source_display.update) # Use the change event to update the HTML component
181
 
182
  if __name__ == "__main__":
183
  demo.queue().launch()