Spaces:
Sleeping
Sleeping
wuhuikai commited on
Commit ·
28048c6
1
Parent(s): 7a986fc
add topic
Browse files
app.py
CHANGED
|
@@ -807,11 +807,12 @@ def chat_paper_main(args):
|
|
| 807 |
reader1.summary_with_chat(paper_list=paper_list)
|
| 808 |
|
| 809 |
|
| 810 |
-
def upload(file):
|
| 811 |
global reader1, paper_list
|
| 812 |
|
| 813 |
args = parser.parse_args()
|
| 814 |
args.pdf_path = file.name
|
|
|
|
| 815 |
reader1, paper_list = chat_paper_main(args=args)
|
| 816 |
|
| 817 |
return reader1.summary(paper_list)
|
|
@@ -844,6 +845,7 @@ if __name__ == '__main__':
|
|
| 844 |
|
| 845 |
with gr.Blocks(css=".output-image {height: 800px !important}") as demo:
|
| 846 |
with gr.Column():
|
|
|
|
| 847 |
pdf_file = gr.File(label="上传论文(必须为PDF)")
|
| 848 |
summary_input = gr.Text(label='Summary Input')
|
| 849 |
summary_output = gr.Text(label='Summary Output')
|
|
@@ -855,7 +857,7 @@ if __name__ == '__main__':
|
|
| 855 |
conclusion_output = gr.Text(label='Conclusion Output')
|
| 856 |
result_button = gr.Button(value='Next')
|
| 857 |
result = gr.Text(label='Result')
|
| 858 |
-
pdf_file.upload(upload, [pdf_file], [summary_input])
|
| 859 |
method_input_button.click(lambda x: reader1.method(paper_list, x), [summary_output], [method_input])
|
| 860 |
conclusion_input_button.click(lambda x, y: reader1.conclusion(paper_list, x, y), [summary_output, method_output], [conclusion_input])
|
| 861 |
result_button.click(lambda x, y, z: '\n'.join([x, y, z]), [summary_output, method_output, conclusion_output], [result])
|
|
|
|
| 807 |
reader1.summary_with_chat(paper_list=paper_list)
|
| 808 |
|
| 809 |
|
| 810 |
+
def upload(topic_str, file):
|
| 811 |
global reader1, paper_list
|
| 812 |
|
| 813 |
args = parser.parse_args()
|
| 814 |
args.pdf_path = file.name
|
| 815 |
+
args.key_word = 'education' if len(topic_str) < 1 else topic_str
|
| 816 |
reader1, paper_list = chat_paper_main(args=args)
|
| 817 |
|
| 818 |
return reader1.summary(paper_list)
|
|
|
|
| 845 |
|
| 846 |
with gr.Blocks(css=".output-image {height: 800px !important}") as demo:
|
| 847 |
with gr.Column():
|
| 848 |
+
topic = gr.Text(label='Topic')
|
| 849 |
pdf_file = gr.File(label="上传论文(必须为PDF)")
|
| 850 |
summary_input = gr.Text(label='Summary Input')
|
| 851 |
summary_output = gr.Text(label='Summary Output')
|
|
|
|
| 857 |
conclusion_output = gr.Text(label='Conclusion Output')
|
| 858 |
result_button = gr.Button(value='Next')
|
| 859 |
result = gr.Text(label='Result')
|
| 860 |
+
pdf_file.upload(upload, [topic, pdf_file], [summary_input])
|
| 861 |
method_input_button.click(lambda x: reader1.method(paper_list, x), [summary_output], [method_input])
|
| 862 |
conclusion_input_button.click(lambda x, y: reader1.conclusion(paper_list, x, y), [summary_output, method_output], [conclusion_input])
|
| 863 |
result_button.click(lambda x, y, z: '\n'.join([x, y, z]), [summary_output, method_output, conclusion_output], [result])
|