Omar Solano
commited on
Commit
Β·
beeea5a
1
Parent(s):
f0db5cb
remove sources
Browse files- scripts/gradio-ui.py +6 -10
scripts/gradio-ui.py
CHANGED
@@ -156,7 +156,7 @@ def format_sources(completion) -> str:
|
|
156 |
"π Here are the sources I used to answer your question:\n\n{documents}\n\n{footnote}"
|
157 |
)
|
158 |
document_template: str = (
|
159 |
-
"[π {source}: {title}]({url}), relevance: {score:2.
|
160 |
)
|
161 |
|
162 |
documents = "\n".join(
|
@@ -218,20 +218,16 @@ with gr.Blocks(
|
|
218 |
fill_height=True,
|
219 |
) as demo:
|
220 |
with gr.Row():
|
221 |
-
gr.
|
222 |
"<h3><center>Towards AI π€: A Question-Answering Bot for anything AI-related</center></h3>"
|
223 |
)
|
224 |
|
225 |
latest_completion = gr.State()
|
226 |
|
227 |
-
|
228 |
-
|
229 |
-
label="Select Sources",
|
230 |
-
value=AVAILABLE_SOURCES_UI,
|
231 |
-
multiselect=True,
|
232 |
)
|
233 |
|
234 |
-
chatbot = gr.Chatbot(elem_id="chatbot", show_copy_button=True, scale=2)
|
235 |
with gr.Row():
|
236 |
question = gr.Textbox(
|
237 |
label="What's your question?",
|
@@ -261,14 +257,14 @@ with gr.Blocks(
|
|
261 |
completion = gr.State()
|
262 |
|
263 |
submit.click(user, [question, chatbot], [question, chatbot], queue=False).then(
|
264 |
-
get_answer, inputs=[chatbot
|
265 |
).then(add_sources, inputs=[chatbot, completion], outputs=[chatbot])
|
266 |
# .then(
|
267 |
# save_completion, inputs=[completion, chatbot]
|
268 |
# )
|
269 |
|
270 |
question.submit(user, [question, chatbot], [question, chatbot], queue=False).then(
|
271 |
-
get_answer, inputs=[chatbot
|
272 |
).then(add_sources, inputs=[chatbot, completion], outputs=[chatbot])
|
273 |
# .then(
|
274 |
# save_completion, inputs=[completion, chatbot]
|
|
|
156 |
"π Here are the sources I used to answer your question:\n\n{documents}\n\n{footnote}"
|
157 |
)
|
158 |
document_template: str = (
|
159 |
+
"[π {source}: {title}]({url}), relevance: {score:2.2f}" # Adjusted to include URL and format score as relevance
|
160 |
)
|
161 |
|
162 |
documents = "\n".join(
|
|
|
218 |
fill_height=True,
|
219 |
) as demo:
|
220 |
with gr.Row():
|
221 |
+
gr.HTML(
|
222 |
"<h3><center>Towards AI π€: A Question-Answering Bot for anything AI-related</center></h3>"
|
223 |
)
|
224 |
|
225 |
latest_completion = gr.State()
|
226 |
|
227 |
+
chatbot = gr.Chatbot(
|
228 |
+
elem_id="chatbot", show_copy_button=True, scale=2, likeable=True
|
|
|
|
|
|
|
229 |
)
|
230 |
|
|
|
231 |
with gr.Row():
|
232 |
question = gr.Textbox(
|
233 |
label="What's your question?",
|
|
|
257 |
completion = gr.State()
|
258 |
|
259 |
submit.click(user, [question, chatbot], [question, chatbot], queue=False).then(
|
260 |
+
get_answer, inputs=[chatbot], outputs=[chatbot, completion]
|
261 |
).then(add_sources, inputs=[chatbot, completion], outputs=[chatbot])
|
262 |
# .then(
|
263 |
# save_completion, inputs=[completion, chatbot]
|
264 |
# )
|
265 |
|
266 |
question.submit(user, [question, chatbot], [question, chatbot], queue=False).then(
|
267 |
+
get_answer, inputs=[chatbot], outputs=[chatbot, completion]
|
268 |
).then(add_sources, inputs=[chatbot, completion], outputs=[chatbot])
|
269 |
# .then(
|
270 |
# save_completion, inputs=[completion, chatbot]
|