Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -25,7 +25,7 @@ def download_pdf(url, dest_folder):
|
|
25 |
for chunk in response.iter_content(chunk_size=1024):
|
26 |
if chunk:
|
27 |
file.write(chunk)
|
28 |
-
|
29 |
return filename
|
30 |
|
31 |
# Example Usage
|
@@ -63,8 +63,8 @@ with gr.Blocks(css="#htext span {white-space: pre-line}") as demo:
|
|
63 |
ctrlsum_file_examples = gr.Examples(examples=[["examples/H01-1042_body.txt", 50, "automatic evaluation technique"],["examples/H01-1042.pdf", 0, "automatic evaluation technique"]],
|
64 |
inputs=[ctrlsum_file, ctrlsum_file_length, ctrlsum_file_keywords])
|
65 |
|
66 |
-
if
|
67 |
-
ctrlsum_file = download_pdf(ctrlsum_url, './
|
68 |
|
69 |
ctrlsum_file_btn.click(
|
70 |
fn=ctrlsum_for_file,
|
|
|
25 |
for chunk in response.iter_content(chunk_size=1024):
|
26 |
if chunk:
|
27 |
file.write(chunk)
|
28 |
+
print(f"Downloaded {url} to {filename}")
|
29 |
return filename
|
30 |
|
31 |
# Example Usage
|
|
|
63 |
ctrlsum_file_examples = gr.Examples(examples=[["examples/H01-1042_body.txt", 50, "automatic evaluation technique"],["examples/H01-1042.pdf", 0, "automatic evaluation technique"]],
|
64 |
inputs=[ctrlsum_file, ctrlsum_file_length, ctrlsum_file_keywords])
|
65 |
|
66 |
+
if len(ctrlsum_url.value) > 4:
|
67 |
+
ctrlsum_file = download_pdf(ctrlsum_url.value, './cache/')
|
68 |
|
69 |
ctrlsum_file_btn.click(
|
70 |
fn=ctrlsum_for_file,
|