Spaces:
Running
Running
Commit
·
d3c9a71
1
Parent(s):
86c2dcc
Update app.py
Browse files
app.py
CHANGED
|
@@ -37,6 +37,10 @@ def infer(question):
|
|
| 37 |
response = query_engine.query(question)
|
| 38 |
return str(response)
|
| 39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
with gr.Blocks(theme='WeixuanYuan/Soft_dark') as demo:
|
| 41 |
with gr.Column():
|
| 42 |
chatbot = gr.Chatbot([], elem_id='chatbot')
|
|
@@ -45,12 +49,14 @@ with gr.Blocks(theme='WeixuanYuan/Soft_dark') as demo:
|
|
| 45 |
paper_id = gr.Textbox(label='ArXiv Paper Id', placeholder='1706.03762')
|
| 46 |
langchain_status = gr.Textbox(label='Status', placeholder='', interactive=False)
|
| 47 |
load_paper = gr.Button('Load Paper to LLaMa-Index')
|
|
|
|
| 48 |
|
| 49 |
with gr.Row():
|
| 50 |
question = gr.Textbox(label='Question', placeholder='Type your query...')
|
| 51 |
submit_btn = gr.Button('Submit')
|
| 52 |
|
| 53 |
load_paper.click(paper_changes, inputs=[paper_id], outputs=[langchain_status], queue=False)
|
|
|
|
| 54 |
question.submit(add_text, [chatbot, question], [chatbot, question]).then(bot, chatbot, chatbot)
|
| 55 |
submit_btn.click(add_text, [chatbot, question], [chatbot, question]).then(bot, chatbot, chatbot)
|
| 56 |
|
|
|
|
| 37 |
response = query_engine.query(question)
|
| 38 |
return str(response)
|
| 39 |
|
| 40 |
+
def summarize(history, text='Give a brief summary of the paper under the title `Summary` and the summarize each section of this paper seperately in detailed points.'):
|
| 41 |
+
history = history + [(text, None)]
|
| 42 |
+
return history, ''
|
| 43 |
+
|
| 44 |
with gr.Blocks(theme='WeixuanYuan/Soft_dark') as demo:
|
| 45 |
with gr.Column():
|
| 46 |
chatbot = gr.Chatbot([], elem_id='chatbot')
|
|
|
|
| 49 |
paper_id = gr.Textbox(label='ArXiv Paper Id', placeholder='1706.03762')
|
| 50 |
langchain_status = gr.Textbox(label='Status', placeholder='', interactive=False)
|
| 51 |
load_paper = gr.Button('Load Paper to LLaMa-Index')
|
| 52 |
+
summary = gr.Button('Generate Summary')
|
| 53 |
|
| 54 |
with gr.Row():
|
| 55 |
question = gr.Textbox(label='Question', placeholder='Type your query...')
|
| 56 |
submit_btn = gr.Button('Submit')
|
| 57 |
|
| 58 |
load_paper.click(paper_changes, inputs=[paper_id], outputs=[langchain_status], queue=False)
|
| 59 |
+
summary.click(summarize, [chatbot], [chatbot]).then(bot, chatbot, chatbot)
|
| 60 |
question.submit(add_text, [chatbot, question], [chatbot, question]).then(bot, chatbot, chatbot)
|
| 61 |
submit_btn.click(add_text, [chatbot, question], [chatbot, question]).then(bot, chatbot, chatbot)
|
| 62 |
|