Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -564,8 +564,8 @@ def create_gradio_interface():
|
|
| 564 |
if doi:
|
| 565 |
downloader.results_dict[doi] = (filepath, message,fail_message)
|
| 566 |
|
| 567 |
-
updates = update_progress(message)
|
| 568 |
-
|
| 569 |
return updates
|
| 570 |
|
| 571 |
|
|
@@ -574,30 +574,30 @@ def create_gradio_interface():
|
|
| 574 |
if not bib_file.name.lower().endswith('.bib'):
|
| 575 |
return None, "Error: Please upload a .bib file", "Error: Please upload a .bib file", None
|
| 576 |
|
| 577 |
-
|
| 578 |
-
|
| 579 |
bib_file,
|
| 580 |
lambda a,b,c: update_progress(a,f"{b}<br>{c}"), #convert for ui output, the return data will contain the HTML
|
| 581 |
-
|
| 582 |
-
|
| 583 |
-
|
| 584 |
-
|
| 585 |
|
| 586 |
elif doi_input:
|
| 587 |
|
| 588 |
-
|
| 589 |
-
|
| 590 |
-
|
| 591 |
lambda a,b,c: update_progress(a,f"{b}<br>{c}") , #callback function, format output and send html info, removed lambda from executor calls
|
| 592 |
-
|
| 593 |
)
|
| 594 |
|
| 595 |
-
|
| 596 |
|
| 597 |
elif dois_input:
|
| 598 |
downloader.download_task = downloader.executor.submit( #changed async execution method
|
| 599 |
-
|
| 600 |
-
|
| 601 |
lambda a,b,c: update_progress(a,f"{b}<br>{c}") ,#callback function
|
| 602 |
cancel_event #Add cancellation event.
|
| 603 |
)
|
|
@@ -606,6 +606,7 @@ def create_gradio_interface():
|
|
| 606 |
|
| 607 |
else:
|
| 608 |
return None, "Please provide a .bib file, a single DOI, or a list of DOIs", "Please provide a .bib file, a single DOI, or a list of DOIs","", None
|
|
|
|
| 609 |
|
| 610 |
|
| 611 |
|
|
|
|
| 564 |
if doi:
|
| 565 |
downloader.results_dict[doi] = (filepath, message,fail_message)
|
| 566 |
|
| 567 |
+
updates = update_progress(message,fail_message) #use update function here
|
| 568 |
+
|
| 569 |
return updates
|
| 570 |
|
| 571 |
|
|
|
|
| 574 |
if not bib_file.name.lower().endswith('.bib'):
|
| 575 |
return None, "Error: Please upload a .bib file", "Error: Please upload a .bib file", None
|
| 576 |
|
| 577 |
+
downloader.download_task = downloader.executor.submit(
|
| 578 |
+
downloader.process_bibtex,
|
| 579 |
bib_file,
|
| 580 |
lambda a,b,c: update_progress(a,f"{b}<br>{c}"), #convert for ui output, the return data will contain the HTML
|
| 581 |
+
cancel_event # Added cancelllation event.
|
| 582 |
+
)
|
| 583 |
+
|
| 584 |
+
return None,"","",None
|
| 585 |
|
| 586 |
elif doi_input:
|
| 587 |
|
| 588 |
+
downloader.download_task = downloader.executor.submit( #changed async execution method
|
| 589 |
+
downloader._download_single_doi,
|
| 590 |
+
doi_input,
|
| 591 |
lambda a,b,c: update_progress(a,f"{b}<br>{c}") , #callback function, format output and send html info, removed lambda from executor calls
|
| 592 |
+
cancel_event # Add cancellation event.
|
| 593 |
)
|
| 594 |
|
| 595 |
+
return None, "","", None
|
| 596 |
|
| 597 |
elif dois_input:
|
| 598 |
downloader.download_task = downloader.executor.submit( #changed async execution method
|
| 599 |
+
downloader.download_multiple_dois,
|
| 600 |
+
dois_input,
|
| 601 |
lambda a,b,c: update_progress(a,f"{b}<br>{c}") ,#callback function
|
| 602 |
cancel_event #Add cancellation event.
|
| 603 |
)
|
|
|
|
| 606 |
|
| 607 |
else:
|
| 608 |
return None, "Please provide a .bib file, a single DOI, or a list of DOIs", "Please provide a .bib file, a single DOI, or a list of DOIs","", None
|
| 609 |
+
|
| 610 |
|
| 611 |
|
| 612 |
|