Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
|
|
|
|
|
|
|
|
|
| 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()
|