Spaces:
Runtime error
Runtime error
load PDF example alt
Browse filesSigned-off-by: peter szemraj <peterszemraj@gmail.com>
utils.py
CHANGED
@@ -6,7 +6,7 @@ import re
|
|
6 |
from pathlib import Path
|
7 |
|
8 |
from natsort import natsorted
|
9 |
-
|
10 |
|
11 |
def truncate_word_count(text, max_words=512):
|
12 |
"""
|
@@ -39,6 +39,9 @@ def load_examples(src, filetypes=[".txt", ".pdf"]):
|
|
39 |
"""
|
40 |
src = Path(src)
|
41 |
src.mkdir(exist_ok=True)
|
|
|
|
|
|
|
42 |
examples = [f for f in src.iterdir() if f.suffix in filetypes]
|
43 |
examples = natsorted(examples)
|
44 |
# load the examples into a list
|
|
|
6 |
from pathlib import Path
|
7 |
|
8 |
from natsort import natsorted
|
9 |
+
import subprocess
|
10 |
|
11 |
def truncate_word_count(text, max_words=512):
|
12 |
"""
|
|
|
39 |
"""
|
40 |
src = Path(src)
|
41 |
src.mkdir(exist_ok=True)
|
42 |
+
|
43 |
+
pdf_url = "https://www.dropbox.com/s/y92xy7o5qb88yij/all_you_need_is_attention.pdf?dl=1"
|
44 |
+
subprocess.run(["wget", pdf_url, "-O", src / "all_you_need_is_attention.pdf"])
|
45 |
examples = [f for f in src.iterdir() if f.suffix in filetypes]
|
46 |
examples = natsorted(examples)
|
47 |
# load the examples into a list
|