Pclanglais commited on
Commit
d9bfa30
1 Parent(s): 34bbc8b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -12
app.py CHANGED
@@ -165,6 +165,7 @@ def user(message, history):
165
  history_transformer_format = history + [[message, ""]]
166
 
167
  print(history_transformer_format)
 
168
  return "", history_transformer_format, source_text
169
 
170
  # Define the Gradio interface
@@ -178,18 +179,21 @@ examples = [
178
  ]
179
 
180
  with gr.Blocks() as demo:
181
- chatbot = gr.Chatbot()
182
- msg = gr.Textbox()
183
- clear = gr.Button("Clear")
184
-
185
- user_output = gr.HTML() # To display the user's message
186
- history = gr.State()
187
-
188
- msg.submit(user, inputs=[msg, chatbot], outputs=[msg, chatbot, user_output], queue=False).then(
189
- predict, chatbot, chatbot
190
- )
191
-
192
- clear.click(lambda: None, None, chatbot, queue=False)
 
 
 
193
 
194
 
195
  demo.queue()
 
165
  history_transformer_format = history + [[message, ""]]
166
 
167
  print(history_transformer_format)
168
+ source_text = "<h3>Sources</h3><p>" + source_text + "</p>"
169
  return "", history_transformer_format, source_text
170
 
171
  # Define the Gradio interface
 
179
  ]
180
 
181
  with gr.Blocks() as demo:
182
+ with gr.Row():
183
+ with gr.Column(scale=2):
184
+ chatbot = gr.Chatbot()
185
+ msg = gr.Textbox()
186
+ clear = gr.Button("Clear")
187
+
188
+ history = gr.State()
189
+
190
+ msg.submit(user, inputs=[msg, chatbot], outputs=[msg, chatbot, user_output], queue=False).then(
191
+ predict, chatbot, chatbot
192
+ )
193
+
194
+ clear.click(lambda: None, None, chatbot, queue=False)
195
+ with gr.Column(scale=1):
196
+ user_output = gr.HTML() # To display the user's message
197
 
198
 
199
  demo.queue()