Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -167,7 +167,8 @@ with gr.Blocks(css=STYLE, theme=gr.themes.Soft()) as demo:
|
|
| 167 |
arxiv_id_enter.submit(
|
| 168 |
add_arxiv_ids_to_queue,
|
| 169 |
[arxiv_queue, arxiv_id_enter],
|
| 170 |
-
[arxiv_queue, arxiv_id_enter]
|
|
|
|
| 171 |
)
|
| 172 |
|
| 173 |
|
|
@@ -179,61 +180,71 @@ with gr.Blocks(css=STYLE, theme=gr.themes.Soft()) as demo:
|
|
| 179 |
search_r1.click(set_date, search_r1, [year_dd, month_dd, day_dd]).then(
|
| 180 |
set_papers,
|
| 181 |
inputs=[year_dd, month_dd, day_dd, search_r1],
|
| 182 |
-
outputs=[cur_arxiv_id, papers_dd, search_in]
|
|
|
|
| 183 |
)
|
| 184 |
|
| 185 |
search_r2.click(set_date, search_r2, [year_dd, month_dd, day_dd]).then(
|
| 186 |
set_papers,
|
| 187 |
inputs=[year_dd, month_dd, day_dd, search_r2],
|
| 188 |
-
outputs=[cur_arxiv_id, papers_dd, search_in]
|
|
|
|
| 189 |
)
|
| 190 |
|
| 191 |
search_r3.click(set_date, search_r3, [year_dd, month_dd, day_dd]).then(
|
| 192 |
set_papers,
|
| 193 |
inputs=[year_dd, month_dd, day_dd, search_r3],
|
| 194 |
-
outputs=[cur_arxiv_id, papers_dd, search_in]
|
|
|
|
| 195 |
)
|
| 196 |
|
| 197 |
search_r4.click(set_date, search_r4, [year_dd, month_dd, day_dd]).then(
|
| 198 |
set_papers,
|
| 199 |
inputs=[year_dd, month_dd, day_dd, search_r4],
|
| 200 |
-
outputs=[cur_arxiv_id, papers_dd, search_in]
|
|
|
|
| 201 |
)
|
| 202 |
|
| 203 |
search_r5.click(set_date, search_r5, [year_dd, month_dd, day_dd]).then(
|
| 204 |
set_papers,
|
| 205 |
inputs=[year_dd, month_dd, day_dd, search_r5],
|
| 206 |
-
outputs=[cur_arxiv_id, papers_dd, search_in]
|
|
|
|
| 207 |
)
|
| 208 |
|
| 209 |
search_r6.click(set_date, search_r6, [year_dd, month_dd, day_dd]).then(
|
| 210 |
set_papers,
|
| 211 |
inputs=[year_dd, month_dd, day_dd, search_r6],
|
| 212 |
-
outputs=[cur_arxiv_id, papers_dd, search_in]
|
|
|
|
| 213 |
)
|
| 214 |
|
| 215 |
search_r7.click(set_date, search_r7, [year_dd, month_dd, day_dd]).then(
|
| 216 |
set_papers,
|
| 217 |
inputs=[year_dd, month_dd, day_dd, search_r7],
|
| 218 |
-
outputs=[cur_arxiv_id, papers_dd, search_in]
|
|
|
|
| 219 |
)
|
| 220 |
|
| 221 |
search_r8.click(set_date, search_r8, [year_dd, month_dd, day_dd]).then(
|
| 222 |
set_papers,
|
| 223 |
inputs=[year_dd, month_dd, day_dd, search_r8],
|
| 224 |
-
outputs=[cur_arxiv_id, papers_dd, search_in]
|
|
|
|
| 225 |
)
|
| 226 |
|
| 227 |
search_r9.click(set_date, search_r9, [year_dd, month_dd, day_dd]).then(
|
| 228 |
set_papers,
|
| 229 |
inputs=[year_dd, month_dd, day_dd, search_r9],
|
| 230 |
-
outputs=[cur_arxiv_id, papers_dd, search_in]
|
|
|
|
| 231 |
)
|
| 232 |
|
| 233 |
search_r10.click(set_date, search_r10, [year_dd, month_dd, day_dd]).then(
|
| 234 |
set_papers,
|
| 235 |
inputs=[year_dd, month_dd, day_dd, search_r10],
|
| 236 |
-
outputs=[cur_arxiv_id, papers_dd, search_in]
|
|
|
|
| 237 |
)
|
| 238 |
|
| 239 |
year_dd.input(get_paper_by_year, inputs=[year_dd], outputs=[month_dd, day_dd, papers_dd]).then(
|
|
@@ -252,7 +263,8 @@ with gr.Blocks(css=STYLE, theme=gr.themes.Soft()) as demo:
|
|
| 252 |
basic_q_2, basic_q_eli5_2, basic_q_expert_2,
|
| 253 |
depth_q_2, depth_q_eli5_2, depth_q_expert_2,
|
| 254 |
breath_q_2, breath_q_eli5_2, breath_q_expert_2
|
| 255 |
-
]
|
|
|
|
| 256 |
)
|
| 257 |
|
| 258 |
month_dd.input(get_paper_by_month, inputs=[year_dd, month_dd], outputs=[day_dd, papers_dd]).then(
|
|
@@ -271,7 +283,8 @@ with gr.Blocks(css=STYLE, theme=gr.themes.Soft()) as demo:
|
|
| 271 |
basic_q_2, basic_q_eli5_2, basic_q_expert_2,
|
| 272 |
depth_q_2, depth_q_eli5_2, depth_q_expert_2,
|
| 273 |
breath_q_2, breath_q_eli5_2, breath_q_expert_2
|
| 274 |
-
]
|
|
|
|
| 275 |
)
|
| 276 |
|
| 277 |
day_dd.input(get_paper_by_day, inputs=[year_dd, month_dd, day_dd], outputs=[papers_dd]).then(
|
|
@@ -290,7 +303,8 @@ with gr.Blocks(css=STYLE, theme=gr.themes.Soft()) as demo:
|
|
| 290 |
basic_q_2, basic_q_eli5_2, basic_q_expert_2,
|
| 291 |
depth_q_2, depth_q_eli5_2, depth_q_expert_2,
|
| 292 |
breath_q_2, breath_q_eli5_2, breath_q_expert_2
|
| 293 |
-
]
|
|
|
|
| 294 |
)
|
| 295 |
|
| 296 |
papers_dd.change(set_paper, [year_dd, month_dd, day_dd, papers_dd],
|
|
@@ -308,7 +322,8 @@ with gr.Blocks(css=STYLE, theme=gr.themes.Soft()) as demo:
|
|
| 308 |
basic_q_2, basic_q_eli5_2, basic_q_expert_2,
|
| 309 |
depth_q_2, depth_q_eli5_2, depth_q_expert_2,
|
| 310 |
breath_q_2, breath_q_eli5_2, breath_q_expert_2
|
| 311 |
-
]
|
|
|
|
| 312 |
)
|
| 313 |
|
| 314 |
search_in.change(
|
|
@@ -335,22 +350,26 @@ with gr.Blocks(css=STYLE, theme=gr.themes.Soft()) as demo:
|
|
| 335 |
close.click(None, None, None,js=CLOSE_CHAT_IF)
|
| 336 |
|
| 337 |
prompt_txtbox.submit(
|
| 338 |
-
before_chat_begin, None, [close, reset, regen]
|
|
|
|
| 339 |
).then(
|
| 340 |
chat_stream,
|
| 341 |
[cur_arxiv_id, local_data, prompt_txtbox, chat_state],
|
| 342 |
-
[prompt_txtbox, chatbot, local_data, close, reset, regen]
|
|
|
|
| 343 |
).then(
|
| 344 |
None, [cur_arxiv_id, local_data], None,
|
| 345 |
js=UPDATE_CHAT_HISTORY
|
| 346 |
)
|
| 347 |
|
| 348 |
reset.click(
|
| 349 |
-
before_chat_begin, None, [close, reset, regen]
|
|
|
|
| 350 |
).then(
|
| 351 |
chat_reset,
|
| 352 |
[local_data, chat_state],
|
| 353 |
-
[prompt_txtbox, chatbot, local_data, close, reset, regen]
|
|
|
|
| 354 |
).then(
|
| 355 |
None, [cur_arxiv_id, local_data], None,
|
| 356 |
js=UPDATE_CHAT_HISTORY
|
|
@@ -377,7 +396,6 @@ scheduler.add_job(
|
|
| 377 |
scheduler.start()
|
| 378 |
|
| 379 |
demo.queue(
|
| 380 |
-
concurrency_count=5,
|
| 381 |
max_size=256
|
| 382 |
).launch(
|
| 383 |
debug=True
|
|
|
|
| 167 |
arxiv_id_enter.submit(
|
| 168 |
add_arxiv_ids_to_queue,
|
| 169 |
[arxiv_queue, arxiv_id_enter],
|
| 170 |
+
[arxiv_queue, arxiv_id_enter],
|
| 171 |
+
concurrency_count=5,
|
| 172 |
)
|
| 173 |
|
| 174 |
|
|
|
|
| 180 |
search_r1.click(set_date, search_r1, [year_dd, month_dd, day_dd]).then(
|
| 181 |
set_papers,
|
| 182 |
inputs=[year_dd, month_dd, day_dd, search_r1],
|
| 183 |
+
outputs=[cur_arxiv_id, papers_dd, search_in],
|
| 184 |
+
concurrency_count=5,
|
| 185 |
)
|
| 186 |
|
| 187 |
search_r2.click(set_date, search_r2, [year_dd, month_dd, day_dd]).then(
|
| 188 |
set_papers,
|
| 189 |
inputs=[year_dd, month_dd, day_dd, search_r2],
|
| 190 |
+
outputs=[cur_arxiv_id, papers_dd, search_in],
|
| 191 |
+
concurrency_count=5,
|
| 192 |
)
|
| 193 |
|
| 194 |
search_r3.click(set_date, search_r3, [year_dd, month_dd, day_dd]).then(
|
| 195 |
set_papers,
|
| 196 |
inputs=[year_dd, month_dd, day_dd, search_r3],
|
| 197 |
+
outputs=[cur_arxiv_id, papers_dd, search_in],
|
| 198 |
+
concurrency_count=5,
|
| 199 |
)
|
| 200 |
|
| 201 |
search_r4.click(set_date, search_r4, [year_dd, month_dd, day_dd]).then(
|
| 202 |
set_papers,
|
| 203 |
inputs=[year_dd, month_dd, day_dd, search_r4],
|
| 204 |
+
outputs=[cur_arxiv_id, papers_dd, search_in],
|
| 205 |
+
concurrency_count=5,
|
| 206 |
)
|
| 207 |
|
| 208 |
search_r5.click(set_date, search_r5, [year_dd, month_dd, day_dd]).then(
|
| 209 |
set_papers,
|
| 210 |
inputs=[year_dd, month_dd, day_dd, search_r5],
|
| 211 |
+
outputs=[cur_arxiv_id, papers_dd, search_in],
|
| 212 |
+
concurrency_count=5,
|
| 213 |
)
|
| 214 |
|
| 215 |
search_r6.click(set_date, search_r6, [year_dd, month_dd, day_dd]).then(
|
| 216 |
set_papers,
|
| 217 |
inputs=[year_dd, month_dd, day_dd, search_r6],
|
| 218 |
+
outputs=[cur_arxiv_id, papers_dd, search_in],
|
| 219 |
+
concurrency_count=5,
|
| 220 |
)
|
| 221 |
|
| 222 |
search_r7.click(set_date, search_r7, [year_dd, month_dd, day_dd]).then(
|
| 223 |
set_papers,
|
| 224 |
inputs=[year_dd, month_dd, day_dd, search_r7],
|
| 225 |
+
outputs=[cur_arxiv_id, papers_dd, search_in],
|
| 226 |
+
concurrency_count=5,
|
| 227 |
)
|
| 228 |
|
| 229 |
search_r8.click(set_date, search_r8, [year_dd, month_dd, day_dd]).then(
|
| 230 |
set_papers,
|
| 231 |
inputs=[year_dd, month_dd, day_dd, search_r8],
|
| 232 |
+
outputs=[cur_arxiv_id, papers_dd, search_in],
|
| 233 |
+
concurrency_count=5,
|
| 234 |
)
|
| 235 |
|
| 236 |
search_r9.click(set_date, search_r9, [year_dd, month_dd, day_dd]).then(
|
| 237 |
set_papers,
|
| 238 |
inputs=[year_dd, month_dd, day_dd, search_r9],
|
| 239 |
+
outputs=[cur_arxiv_id, papers_dd, search_in],
|
| 240 |
+
concurrency_count=5,
|
| 241 |
)
|
| 242 |
|
| 243 |
search_r10.click(set_date, search_r10, [year_dd, month_dd, day_dd]).then(
|
| 244 |
set_papers,
|
| 245 |
inputs=[year_dd, month_dd, day_dd, search_r10],
|
| 246 |
+
outputs=[cur_arxiv_id, papers_dd, search_in],
|
| 247 |
+
concurrency_count=5,
|
| 248 |
)
|
| 249 |
|
| 250 |
year_dd.input(get_paper_by_year, inputs=[year_dd], outputs=[month_dd, day_dd, papers_dd]).then(
|
|
|
|
| 263 |
basic_q_2, basic_q_eli5_2, basic_q_expert_2,
|
| 264 |
depth_q_2, depth_q_eli5_2, depth_q_expert_2,
|
| 265 |
breath_q_2, breath_q_eli5_2, breath_q_expert_2
|
| 266 |
+
],
|
| 267 |
+
concurrency_count=5,
|
| 268 |
)
|
| 269 |
|
| 270 |
month_dd.input(get_paper_by_month, inputs=[year_dd, month_dd], outputs=[day_dd, papers_dd]).then(
|
|
|
|
| 283 |
basic_q_2, basic_q_eli5_2, basic_q_expert_2,
|
| 284 |
depth_q_2, depth_q_eli5_2, depth_q_expert_2,
|
| 285 |
breath_q_2, breath_q_eli5_2, breath_q_expert_2
|
| 286 |
+
],
|
| 287 |
+
concurrency_count=5,
|
| 288 |
)
|
| 289 |
|
| 290 |
day_dd.input(get_paper_by_day, inputs=[year_dd, month_dd, day_dd], outputs=[papers_dd]).then(
|
|
|
|
| 303 |
basic_q_2, basic_q_eli5_2, basic_q_expert_2,
|
| 304 |
depth_q_2, depth_q_eli5_2, depth_q_expert_2,
|
| 305 |
breath_q_2, breath_q_eli5_2, breath_q_expert_2
|
| 306 |
+
],
|
| 307 |
+
concurrency_count=5,
|
| 308 |
)
|
| 309 |
|
| 310 |
papers_dd.change(set_paper, [year_dd, month_dd, day_dd, papers_dd],
|
|
|
|
| 322 |
basic_q_2, basic_q_eli5_2, basic_q_expert_2,
|
| 323 |
depth_q_2, depth_q_eli5_2, depth_q_expert_2,
|
| 324 |
breath_q_2, breath_q_eli5_2, breath_q_expert_2
|
| 325 |
+
],
|
| 326 |
+
concurrency_count=5,
|
| 327 |
)
|
| 328 |
|
| 329 |
search_in.change(
|
|
|
|
| 350 |
close.click(None, None, None,js=CLOSE_CHAT_IF)
|
| 351 |
|
| 352 |
prompt_txtbox.submit(
|
| 353 |
+
before_chat_begin, None, [close, reset, regen],
|
| 354 |
+
concurrency_count=5,
|
| 355 |
).then(
|
| 356 |
chat_stream,
|
| 357 |
[cur_arxiv_id, local_data, prompt_txtbox, chat_state],
|
| 358 |
+
[prompt_txtbox, chatbot, local_data, close, reset, regen],
|
| 359 |
+
concurrency_count=5,
|
| 360 |
).then(
|
| 361 |
None, [cur_arxiv_id, local_data], None,
|
| 362 |
js=UPDATE_CHAT_HISTORY
|
| 363 |
)
|
| 364 |
|
| 365 |
reset.click(
|
| 366 |
+
before_chat_begin, None, [close, reset, regen],
|
| 367 |
+
concurrency_count=5,
|
| 368 |
).then(
|
| 369 |
chat_reset,
|
| 370 |
[local_data, chat_state],
|
| 371 |
+
[prompt_txtbox, chatbot, local_data, close, reset, regen],
|
| 372 |
+
concurrency_count=5,
|
| 373 |
).then(
|
| 374 |
None, [cur_arxiv_id, local_data], None,
|
| 375 |
js=UPDATE_CHAT_HISTORY
|
|
|
|
| 396 |
scheduler.start()
|
| 397 |
|
| 398 |
demo.queue(
|
|
|
|
| 399 |
max_size=256
|
| 400 |
).launch(
|
| 401 |
debug=True
|