Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -585,9 +585,9 @@ def create_gradio_interface():
|
|
585 |
|
586 |
downloader.download_task = downloader.executor.submit( #changed async execution method
|
587 |
downloader._download_single_doi,
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
)
|
592 |
|
593 |
return None, "","", None
|
@@ -599,7 +599,7 @@ def create_gradio_interface():
|
|
599 |
lambda a,b,c: update_progress(a,f"{b}<br>{c}") ,#callback function
|
600 |
cancel_event #Add cancellation event.
|
601 |
)
|
602 |
-
|
603 |
return None, "","", None
|
604 |
|
605 |
else:
|
@@ -659,18 +659,17 @@ def create_gradio_interface():
|
|
659 |
|
660 |
single_file= gr.File(label="Downloaded Single PDF")
|
661 |
|
662 |
-
|
663 |
with gr.Row():
|
664 |
stop_button = gr.Button(value="Stop Downloads")
|
|
|
665 |
|
666 |
submit_button.click(
|
667 |
-
|
668 |
inputs=[bib_file, doi_input, dois_input],
|
669 |
outputs=[output_file, downloaded_dois_textbox, failed_dois_textbox,logs, single_file ] # the new output should be a tuple and we output logs too for debugging.
|
670 |
-
|
671 |
-
|
672 |
|
673 |
-
|
674 |
interface.title="🔬 Academic Paper Batch Downloader"
|
675 |
interface.description="Upload a BibTeX file or enter DOIs to download PDFs. We'll attempt to fetch PDFs from multiple sources like Sci-Hub, Libgen, Google Scholar and Crossref. You can use any of the three inputs at any moment."
|
676 |
|
|
|
585 |
|
586 |
downloader.download_task = downloader.executor.submit( #changed async execution method
|
587 |
downloader._download_single_doi,
|
588 |
+
doi_input,
|
589 |
+
lambda a,b,c: update_progress(a,f"{b}<br>{c}") , #callback function, format output and send html info, removed lambda from executor calls
|
590 |
+
cancel_event # Add cancellation event.
|
591 |
)
|
592 |
|
593 |
return None, "","", None
|
|
|
599 |
lambda a,b,c: update_progress(a,f"{b}<br>{c}") ,#callback function
|
600 |
cancel_event #Add cancellation event.
|
601 |
)
|
602 |
+
|
603 |
return None, "","", None
|
604 |
|
605 |
else:
|
|
|
659 |
|
660 |
single_file= gr.File(label="Downloaded Single PDF")
|
661 |
|
|
|
662 |
with gr.Row():
|
663 |
stop_button = gr.Button(value="Stop Downloads")
|
664 |
+
stop_button.click(lambda: downloader.cancel_download(), outputs=None) # added function in object downloader
|
665 |
|
666 |
submit_button.click(
|
667 |
+
download_papers,
|
668 |
inputs=[bib_file, doi_input, dois_input],
|
669 |
outputs=[output_file, downloaded_dois_textbox, failed_dois_textbox,logs, single_file ] # the new output should be a tuple and we output logs too for debugging.
|
670 |
+
)
|
671 |
+
|
672 |
|
|
|
673 |
interface.title="🔬 Academic Paper Batch Downloader"
|
674 |
interface.description="Upload a BibTeX file or enter DOIs to download PDFs. We'll attempt to fetch PDFs from multiple sources like Sci-Hub, Libgen, Google Scholar and Crossref. You can use any of the three inputs at any moment."
|
675 |
|