Spaces:
Runtime error
Runtime error
add regenerate chapter buttom
Browse files- app.py +40 -3
- styles.css +12 -1
- utils.py +13 -12
app.py
CHANGED
|
@@ -13,8 +13,8 @@ import torch
|
|
| 13 |
def first_chap(chapters):
|
| 14 |
chapters_info = {}
|
| 15 |
for i in range(len(chapters)):
|
| 16 |
-
chapters_info[f'chapter_{i}'] = {'content': chapters[i], 'history': [], 'chapter_idx': i+1}
|
| 17 |
-
chapters_info[f'chapter_{len(chapters)}'] = {'content': '', 'history': [], 'chapter_idx': len(chapters) + 1}
|
| 18 |
return chapters_info
|
| 19 |
|
| 20 |
|
|
@@ -40,7 +40,7 @@ with gr.Blocks(css='styles.css', theme=gr.themes.Soft()) as demo:
|
|
| 40 |
arxiv_id = gr.Text(label="arXiv ID", placeholder="Enter the arXiv ID of the paper you want to summarize...",
|
| 41 |
show_label=False, max_lines=1, container=False)
|
| 42 |
btn_0 = gr.Button("Initialization", scale=0)
|
| 43 |
-
with gr.Column(elem_id='chapter-buttons'):
|
| 44 |
btn_10 = gr.Button("generate chapter 10", scale=0, visible=False)
|
| 45 |
btn_9 = gr.Button("generate chapter 9", scale=0, visible=False)
|
| 46 |
btn_8 = gr.Button("generate chapter 8", scale=0, visible=False)
|
|
@@ -51,6 +51,19 @@ with gr.Blocks(css='styles.css', theme=gr.themes.Soft()) as demo:
|
|
| 51 |
btn_3 = gr.Button("generate chapter 3", scale=0)
|
| 52 |
btn_2 = gr.Button("generate chapter 2", scale=0)
|
| 53 |
btn_1 = gr.Button("generate chapter 1", scale=0)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
idx_1 = gr.State(1)
|
| 55 |
idx_2 = gr.State(2)
|
| 56 |
idx_3 = gr.State(3)
|
|
@@ -93,6 +106,7 @@ with gr.Blocks(css='styles.css', theme=gr.themes.Soft()) as demo:
|
|
| 93 |
@gr.render(triggers=[btn_1.click], inputs=[iter_chapters, idx_1])
|
| 94 |
def gen_1(iter_chapters, idx_1):
|
| 95 |
to_markdown_column(iter_chapters, idx_1)
|
|
|
|
| 96 |
gr.Markdown('step 2️⃣: waiting for the prompt..(if it tells you that gpu task aborted or error, just retry that button again)')
|
| 97 |
wait_mk_1 = gr.Markdown('waiting for generating chapter 1...')
|
| 98 |
|
|
@@ -141,6 +155,29 @@ with gr.Blocks(css='styles.css', theme=gr.themes.Soft()) as demo:
|
|
| 141 |
to_markdown_column(iter_chapters, idx_10)
|
| 142 |
wait_mk_10 = gr.Markdown('waiting for generating chapter 10...')
|
| 143 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 144 |
btn_1.click(paper_summarization_1, inputs=[iter_chapters, max_section_tokens, max_subsection_tokens,
|
| 145 |
temperature, top_p, top_k, penalty, max_retry], outputs=[iter_chapters, wait_mk_1])
|
| 146 |
btn_2.click(paper_summarization_2, inputs=[iter_chapters, max_section_tokens, max_subsection_tokens,
|
|
|
|
| 13 |
def first_chap(chapters):
|
| 14 |
chapters_info = {}
|
| 15 |
for i in range(len(chapters)):
|
| 16 |
+
chapters_info[f'chapter_{i}'] = {'content': chapters[i], 'history': [], 'chapter_idx': i+1, 'summary': ''}
|
| 17 |
+
chapters_info[f'chapter_{len(chapters)}'] = {'content': '', 'history': [], 'chapter_idx': len(chapters) + 1, 'summary': ''}
|
| 18 |
return chapters_info
|
| 19 |
|
| 20 |
|
|
|
|
| 40 |
arxiv_id = gr.Text(label="arXiv ID", placeholder="Enter the arXiv ID of the paper you want to summarize...",
|
| 41 |
show_label=False, max_lines=1, container=False)
|
| 42 |
btn_0 = gr.Button("Initialization", scale=0)
|
| 43 |
+
with gr.Column(elem_id='chapter-buttons-right'):
|
| 44 |
btn_10 = gr.Button("generate chapter 10", scale=0, visible=False)
|
| 45 |
btn_9 = gr.Button("generate chapter 9", scale=0, visible=False)
|
| 46 |
btn_8 = gr.Button("generate chapter 8", scale=0, visible=False)
|
|
|
|
| 51 |
btn_3 = gr.Button("generate chapter 3", scale=0)
|
| 52 |
btn_2 = gr.Button("generate chapter 2", scale=0)
|
| 53 |
btn_1 = gr.Button("generate chapter 1", scale=0)
|
| 54 |
+
with gr.Column(elem_id='chapter-content-left'):
|
| 55 |
+
re_btn10 = gr.Button("regenerate chapter 11", scale=0, visible=False)
|
| 56 |
+
re_btn9 = gr.Button("regenerate chapter 10", scale=0, visible=False)
|
| 57 |
+
re_btn8 = gr.Button("regenerate chapter 9", scale=0, visible=False)
|
| 58 |
+
re_btn7 = gr.Button("regenerate chapter 8", scale=0, visible=False)
|
| 59 |
+
re_btn6 = gr.Button("regenerate chapter 7", scale=0)
|
| 60 |
+
re_btn5 = gr.Button("regenerate chapter 6", scale=0)
|
| 61 |
+
re_btn4 = gr.Button("regenerate chapter 5", scale=0)
|
| 62 |
+
re_btn3 = gr.Button("regenerate chapter 4", scale=0)
|
| 63 |
+
re_btn2 = gr.Button("regenerate chapter 3", scale=0)
|
| 64 |
+
re_btn1 = gr.Button("regenerate chapter 2", scale=0)
|
| 65 |
+
re_btn0 = gr.Button("regenerate chapter 1", scale=0)
|
| 66 |
+
|
| 67 |
idx_1 = gr.State(1)
|
| 68 |
idx_2 = gr.State(2)
|
| 69 |
idx_3 = gr.State(3)
|
|
|
|
| 106 |
@gr.render(triggers=[btn_1.click], inputs=[iter_chapters, idx_1])
|
| 107 |
def gen_1(iter_chapters, idx_1):
|
| 108 |
to_markdown_column(iter_chapters, idx_1)
|
| 109 |
+
|
| 110 |
gr.Markdown('step 2️⃣: waiting for the prompt..(if it tells you that gpu task aborted or error, just retry that button again)')
|
| 111 |
wait_mk_1 = gr.Markdown('waiting for generating chapter 1...')
|
| 112 |
|
|
|
|
| 155 |
to_markdown_column(iter_chapters, idx_10)
|
| 156 |
wait_mk_10 = gr.Markdown('waiting for generating chapter 10...')
|
| 157 |
|
| 158 |
+
re_btn0.click(paper_summarization_0, inputs=[iter_chapters, max_section_tokens, max_subsection_tokens,
|
| 159 |
+
temperature, top_p, top_k, penalty, max_retry], outputs=[iter_chapters, wait_mk_0])
|
| 160 |
+
re_btn1.click(paper_summarization_1, inputs=[iter_chapters, max_section_tokens, max_subsection_tokens,
|
| 161 |
+
temperature, top_p, top_k, penalty, max_retry], outputs=[iter_chapters, wait_mk_1])
|
| 162 |
+
re_btn2.click(paper_summarization_2, inputs=[iter_chapters, max_section_tokens, max_subsection_tokens,
|
| 163 |
+
temperature, top_p, top_k, penalty, max_retry], outputs=[iter_chapters, wait_mk_2])
|
| 164 |
+
re_btn3.click(paper_summarization_3, inputs=[iter_chapters, max_section_tokens, max_subsection_tokens,
|
| 165 |
+
temperature, top_p, top_k, penalty, max_retry], outputs=[iter_chapters, wait_mk_3])
|
| 166 |
+
re_btn4.click(paper_summarization_4, inputs=[iter_chapters, max_section_tokens, max_subsection_tokens,
|
| 167 |
+
temperature, top_p, top_k, penalty, max_retry], outputs=[iter_chapters, wait_mk_4])
|
| 168 |
+
re_btn5.click(paper_summarization_5, inputs=[iter_chapters, max_section_tokens, max_subsection_tokens,
|
| 169 |
+
temperature, top_p, top_k, penalty, max_retry], outputs=[iter_chapters, wait_mk_5])
|
| 170 |
+
re_btn6.click(paper_summarization_6, inputs=[iter_chapters, max_section_tokens, max_subsection_tokens,
|
| 171 |
+
temperature, top_p, top_k, penalty, max_retry], outputs=[iter_chapters, wait_mk_6])
|
| 172 |
+
re_btn7.click(paper_summarization_7, inputs=[iter_chapters, max_section_tokens, max_subsection_tokens,
|
| 173 |
+
temperature, top_p, top_k, penalty, max_retry], outputs=[iter_chapters, wait_mk_7])
|
| 174 |
+
re_btn8.click(paper_summarization_8, inputs=[iter_chapters, max_section_tokens, max_subsection_tokens,
|
| 175 |
+
temperature, top_p, top_k, penalty, max_retry], outputs=[iter_chapters, wait_mk_8])
|
| 176 |
+
re_btn9.click(paper_summarization_9, inputs=[iter_chapters, max_section_tokens, max_subsection_tokens,
|
| 177 |
+
temperature, top_p, top_k, penalty, max_retry], outputs=[iter_chapters, wait_mk_9])
|
| 178 |
+
re_btn10.click(paper_summarization_10, inputs=[iter_chapters, max_section_tokens, max_subsection_tokens,
|
| 179 |
+
temperature, top_p, top_k, penalty, max_retry], outputs=[iter_chapters, wait_mk_10])
|
| 180 |
+
|
| 181 |
btn_1.click(paper_summarization_1, inputs=[iter_chapters, max_section_tokens, max_subsection_tokens,
|
| 182 |
temperature, top_p, top_k, penalty, max_retry], outputs=[iter_chapters, wait_mk_1])
|
| 183 |
btn_2.click(paper_summarization_2, inputs=[iter_chapters, max_section_tokens, max_subsection_tokens,
|
styles.css
CHANGED
|
@@ -27,7 +27,7 @@
|
|
| 27 |
box-shadow: 5px 3px 10px 1px rgba(0, 0, 0, 0.4) !important;
|
| 28 |
}
|
| 29 |
|
| 30 |
-
#chapter-buttons {
|
| 31 |
position: fixed;
|
| 32 |
right: 20px;
|
| 33 |
bottom: 600px;
|
|
@@ -38,6 +38,17 @@
|
|
| 38 |
gap: 20px; # Adjust the spacing between buttons
|
| 39 |
}
|
| 40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
.accordion > button > span{
|
| 42 |
font-size: 12pt !important;
|
| 43 |
}
|
|
|
|
| 27 |
box-shadow: 5px 3px 10px 1px rgba(0, 0, 0, 0.4) !important;
|
| 28 |
}
|
| 29 |
|
| 30 |
+
#chapter-buttons-right {
|
| 31 |
position: fixed;
|
| 32 |
right: 20px;
|
| 33 |
bottom: 600px;
|
|
|
|
| 38 |
gap: 20px; # Adjust the spacing between buttons
|
| 39 |
}
|
| 40 |
|
| 41 |
+
#chapter-buttons-left {
|
| 42 |
+
position: fixed;
|
| 43 |
+
left: 20px;
|
| 44 |
+
bottom: 600px;
|
| 45 |
+
width: 50px;
|
| 46 |
+
display: flex;
|
| 47 |
+
flex-direction: column;
|
| 48 |
+
align-items: flex-end;
|
| 49 |
+
gap: 20px; # Adjust the spacing between buttons
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
.accordion > button > span{
|
| 53 |
font-size: 12pt !important;
|
| 54 |
}
|
utils.py
CHANGED
|
@@ -127,6 +127,7 @@ def load_json(raw_snippet):
|
|
| 127 |
|
| 128 |
return json_parsed_string
|
| 129 |
|
|
|
|
| 130 |
@spaces.GPU()
|
| 131 |
def paper_summarization_0(
|
| 132 |
iter_chapters,
|
|
@@ -196,7 +197,7 @@ def paper_summarization_0(
|
|
| 196 |
json_parsed_string = temp
|
| 197 |
history.append([f'your review for chapter {chapter_idx} is: ', buffer])
|
| 198 |
iter_chapters['chapter_1']['history'] = history
|
| 199 |
-
iter_chapters['chapter_0']['
|
| 200 |
del generate_kwargs, input_ids, streamer, conversation, paper_content, buffer, history, json_parsed_string
|
| 201 |
torch.cuda.empty_cache()
|
| 202 |
return iter_chapters, 'successfully generated review for chapter 1! click the button to see the result'
|
|
@@ -279,7 +280,7 @@ def paper_summarization_1(
|
|
| 279 |
json_parsed_string = temp
|
| 280 |
history.append([f'your review for chapter {chapter_idx} is: ', buffer])
|
| 281 |
iter_chapters['chapter_2']['history'] = history
|
| 282 |
-
iter_chapters['chapter_1']['
|
| 283 |
del generate_kwargs, input_ids, streamer, conversation, paper_content, buffer, history, json_parsed_string
|
| 284 |
torch.cuda.empty_cache()
|
| 285 |
return iter_chapters, 'successfully generated review for chapter 2! click the button to see the result'
|
|
@@ -364,7 +365,7 @@ def paper_summarization_2(
|
|
| 364 |
json_parsed_string = temp
|
| 365 |
history.append([f'your review for chapter {chapter_idx} is: ', buffer])
|
| 366 |
iter_chapters['chapter_3']['history'] = history
|
| 367 |
-
iter_chapters['chapter_2']['
|
| 368 |
del generate_kwargs, input_ids, streamer, conversation, paper_content, buffer, history, json_parsed_string
|
| 369 |
torch.cuda.empty_cache()
|
| 370 |
return iter_chapters, 'successfully generated review for chapter 3! click the button to see the result'
|
|
@@ -451,7 +452,7 @@ def paper_summarization_3(
|
|
| 451 |
json_parsed_string = temp
|
| 452 |
history.append([f'your review for chapter {chapter_idx} is: ', buffer])
|
| 453 |
iter_chapters['chapter_4']['history'] = history
|
| 454 |
-
iter_chapters['chapter_3']['
|
| 455 |
del generate_kwargs, input_ids, streamer, conversation, paper_content, buffer, history, json_parsed_string
|
| 456 |
torch.cuda.empty_cache()
|
| 457 |
return iter_chapters, 'successfully generated review for chapter 4! click the button to see the result'
|
|
@@ -538,7 +539,7 @@ def paper_summarization_4(
|
|
| 538 |
json_parsed_string = temp
|
| 539 |
history.append([f'your review for chapter {chapter_idx} is: ', buffer])
|
| 540 |
iter_chapters['chapter_5']['history'] = history
|
| 541 |
-
iter_chapters['chapter_4']['
|
| 542 |
del generate_kwargs, input_ids, streamer, conversation, paper_content, buffer, history, json_parsed_string
|
| 543 |
torch.cuda.empty_cache()
|
| 544 |
return iter_chapters, 'successfully generated review for chapter 5! click the button to see the result'
|
|
@@ -625,7 +626,7 @@ def paper_summarization_5(
|
|
| 625 |
json_parsed_string = temp
|
| 626 |
history.append([f'your review for chapter {chapter_idx} is: ', buffer])
|
| 627 |
iter_chapters['chapter_6']['history'] = history
|
| 628 |
-
iter_chapters['chapter_5']['
|
| 629 |
del generate_kwargs, input_ids, streamer, conversation, paper_content, buffer, history, json_parsed_string
|
| 630 |
torch.cuda.empty_cache()
|
| 631 |
return iter_chapters, 'successfully generated review for chapter 6! click the button to see the result'
|
|
@@ -712,7 +713,7 @@ def paper_summarization_6(
|
|
| 712 |
json_parsed_string = temp
|
| 713 |
history.append([f'your review for chapter {chapter_idx} is: ', buffer])
|
| 714 |
iter_chapters['chapter_7']['history'] = history
|
| 715 |
-
iter_chapters['chapter_6']['
|
| 716 |
del generate_kwargs, input_ids, streamer, conversation, paper_content, buffer, history, json_parsed_string
|
| 717 |
torch.cuda.empty_cache()
|
| 718 |
return iter_chapters, 'successfully generated review for chapter 7! click the button to see the result'
|
|
@@ -799,7 +800,7 @@ def paper_summarization_7(
|
|
| 799 |
json_parsed_string = temp
|
| 800 |
history.append([f'your review for chapter {chapter_idx} is: ', buffer])
|
| 801 |
iter_chapters['chapter_8']['history'] = history
|
| 802 |
-
iter_chapters['chapter_7']['
|
| 803 |
del generate_kwargs, input_ids, streamer, conversation, paper_content, buffer, history, json_parsed_string
|
| 804 |
torch.cuda.empty_cache()
|
| 805 |
return iter_chapters
|
|
@@ -882,7 +883,7 @@ def paper_summarization_8(
|
|
| 882 |
json_parsed_string = temp
|
| 883 |
history.append([f'your review for chapter {chapter_idx} is: ', buffer])
|
| 884 |
iter_chapters['chapter_9']['history'] = history
|
| 885 |
-
iter_chapters['chapter_8']['
|
| 886 |
del generate_kwargs, input_ids, streamer, conversation, paper_content, buffer, history, json_parsed_string
|
| 887 |
torch.cuda.empty_cache()
|
| 888 |
return iter_chapters
|
|
@@ -965,7 +966,7 @@ def paper_summarization_9(
|
|
| 965 |
json_parsed_string = temp
|
| 966 |
history.append([f'your review for chapter {chapter_idx} is: ', buffer])
|
| 967 |
iter_chapters['chapter_10']['history'] = history
|
| 968 |
-
iter_chapters['chapter_9']['
|
| 969 |
del generate_kwargs, input_ids, streamer, conversation, paper_content, buffer, history, json_parsed_string
|
| 970 |
torch.cuda.empty_cache()
|
| 971 |
return iter_chapters
|
|
@@ -1048,7 +1049,7 @@ def paper_summarization_10(
|
|
| 1048 |
json_parsed_string = temp
|
| 1049 |
history.append([f'your review for chapter {chapter_idx} is: ', buffer])
|
| 1050 |
# iter_chapters['chapter_11']['history'] = history
|
| 1051 |
-
iter_chapters['chapter_10']['
|
| 1052 |
del generate_kwargs, input_ids, streamer, conversation, paper_content, buffer, history, json_parsed_string
|
| 1053 |
torch.cuda.empty_cache()
|
| 1054 |
return iter_chapters
|
|
@@ -1109,7 +1110,7 @@ def return_chapters(arxiv_id):
|
|
| 1109 |
|
| 1110 |
|
| 1111 |
def to_markdown_column(iter_chapters, chap_idx):
|
| 1112 |
-
chap_sum = iter_chapters[f'chapter_{chap_idx-1}']['
|
| 1113 |
if chap_idx == 1:
|
| 1114 |
with gr.Row():
|
| 1115 |
gr.Markdown(
|
|
|
|
| 127 |
|
| 128 |
return json_parsed_string
|
| 129 |
|
| 130 |
+
|
| 131 |
@spaces.GPU()
|
| 132 |
def paper_summarization_0(
|
| 133 |
iter_chapters,
|
|
|
|
| 197 |
json_parsed_string = temp
|
| 198 |
history.append([f'your review for chapter {chapter_idx} is: ', buffer])
|
| 199 |
iter_chapters['chapter_1']['history'] = history
|
| 200 |
+
iter_chapters['chapter_0']['summary'] = json_parsed_string
|
| 201 |
del generate_kwargs, input_ids, streamer, conversation, paper_content, buffer, history, json_parsed_string
|
| 202 |
torch.cuda.empty_cache()
|
| 203 |
return iter_chapters, 'successfully generated review for chapter 1! click the button to see the result'
|
|
|
|
| 280 |
json_parsed_string = temp
|
| 281 |
history.append([f'your review for chapter {chapter_idx} is: ', buffer])
|
| 282 |
iter_chapters['chapter_2']['history'] = history
|
| 283 |
+
iter_chapters['chapter_1']['summary'] = json_parsed_string
|
| 284 |
del generate_kwargs, input_ids, streamer, conversation, paper_content, buffer, history, json_parsed_string
|
| 285 |
torch.cuda.empty_cache()
|
| 286 |
return iter_chapters, 'successfully generated review for chapter 2! click the button to see the result'
|
|
|
|
| 365 |
json_parsed_string = temp
|
| 366 |
history.append([f'your review for chapter {chapter_idx} is: ', buffer])
|
| 367 |
iter_chapters['chapter_3']['history'] = history
|
| 368 |
+
iter_chapters['chapter_2']['summary'] = json_parsed_string
|
| 369 |
del generate_kwargs, input_ids, streamer, conversation, paper_content, buffer, history, json_parsed_string
|
| 370 |
torch.cuda.empty_cache()
|
| 371 |
return iter_chapters, 'successfully generated review for chapter 3! click the button to see the result'
|
|
|
|
| 452 |
json_parsed_string = temp
|
| 453 |
history.append([f'your review for chapter {chapter_idx} is: ', buffer])
|
| 454 |
iter_chapters['chapter_4']['history'] = history
|
| 455 |
+
iter_chapters['chapter_3']['summary'] = json_parsed_string
|
| 456 |
del generate_kwargs, input_ids, streamer, conversation, paper_content, buffer, history, json_parsed_string
|
| 457 |
torch.cuda.empty_cache()
|
| 458 |
return iter_chapters, 'successfully generated review for chapter 4! click the button to see the result'
|
|
|
|
| 539 |
json_parsed_string = temp
|
| 540 |
history.append([f'your review for chapter {chapter_idx} is: ', buffer])
|
| 541 |
iter_chapters['chapter_5']['history'] = history
|
| 542 |
+
iter_chapters['chapter_4']['summary'] = json_parsed_string
|
| 543 |
del generate_kwargs, input_ids, streamer, conversation, paper_content, buffer, history, json_parsed_string
|
| 544 |
torch.cuda.empty_cache()
|
| 545 |
return iter_chapters, 'successfully generated review for chapter 5! click the button to see the result'
|
|
|
|
| 626 |
json_parsed_string = temp
|
| 627 |
history.append([f'your review for chapter {chapter_idx} is: ', buffer])
|
| 628 |
iter_chapters['chapter_6']['history'] = history
|
| 629 |
+
iter_chapters['chapter_5']['summary'] = json_parsed_string
|
| 630 |
del generate_kwargs, input_ids, streamer, conversation, paper_content, buffer, history, json_parsed_string
|
| 631 |
torch.cuda.empty_cache()
|
| 632 |
return iter_chapters, 'successfully generated review for chapter 6! click the button to see the result'
|
|
|
|
| 713 |
json_parsed_string = temp
|
| 714 |
history.append([f'your review for chapter {chapter_idx} is: ', buffer])
|
| 715 |
iter_chapters['chapter_7']['history'] = history
|
| 716 |
+
iter_chapters['chapter_6']['summary'] = json_parsed_string
|
| 717 |
del generate_kwargs, input_ids, streamer, conversation, paper_content, buffer, history, json_parsed_string
|
| 718 |
torch.cuda.empty_cache()
|
| 719 |
return iter_chapters, 'successfully generated review for chapter 7! click the button to see the result'
|
|
|
|
| 800 |
json_parsed_string = temp
|
| 801 |
history.append([f'your review for chapter {chapter_idx} is: ', buffer])
|
| 802 |
iter_chapters['chapter_8']['history'] = history
|
| 803 |
+
iter_chapters['chapter_7']['summary'] = json_parsed_string
|
| 804 |
del generate_kwargs, input_ids, streamer, conversation, paper_content, buffer, history, json_parsed_string
|
| 805 |
torch.cuda.empty_cache()
|
| 806 |
return iter_chapters
|
|
|
|
| 883 |
json_parsed_string = temp
|
| 884 |
history.append([f'your review for chapter {chapter_idx} is: ', buffer])
|
| 885 |
iter_chapters['chapter_9']['history'] = history
|
| 886 |
+
iter_chapters['chapter_8']['summary'] = json_parsed_string
|
| 887 |
del generate_kwargs, input_ids, streamer, conversation, paper_content, buffer, history, json_parsed_string
|
| 888 |
torch.cuda.empty_cache()
|
| 889 |
return iter_chapters
|
|
|
|
| 966 |
json_parsed_string = temp
|
| 967 |
history.append([f'your review for chapter {chapter_idx} is: ', buffer])
|
| 968 |
iter_chapters['chapter_10']['history'] = history
|
| 969 |
+
iter_chapters['chapter_9']['summary'] = json_parsed_string
|
| 970 |
del generate_kwargs, input_ids, streamer, conversation, paper_content, buffer, history, json_parsed_string
|
| 971 |
torch.cuda.empty_cache()
|
| 972 |
return iter_chapters
|
|
|
|
| 1049 |
json_parsed_string = temp
|
| 1050 |
history.append([f'your review for chapter {chapter_idx} is: ', buffer])
|
| 1051 |
# iter_chapters['chapter_11']['history'] = history
|
| 1052 |
+
iter_chapters['chapter_10']['summary'] = json_parsed_string
|
| 1053 |
del generate_kwargs, input_ids, streamer, conversation, paper_content, buffer, history, json_parsed_string
|
| 1054 |
torch.cuda.empty_cache()
|
| 1055 |
return iter_chapters
|
|
|
|
| 1110 |
|
| 1111 |
|
| 1112 |
def to_markdown_column(iter_chapters, chap_idx):
|
| 1113 |
+
chap_sum = iter_chapters[f'chapter_{chap_idx-1}']['summary']
|
| 1114 |
if chap_idx == 1:
|
| 1115 |
with gr.Row():
|
| 1116 |
gr.Markdown(
|