mirror of
https://github.com/hwchase17/langchain
synced 2024-11-06 03:20:49 +00:00
fix path (#1168)
This commit is contained in:
parent
e8f224fd3a
commit
37dd34bea5
@ -1,6 +1,7 @@
|
||||
"""Loader that loads online PDF files."""
|
||||
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
from typing import List
|
||||
|
||||
import requests
|
||||
@ -21,9 +22,9 @@ class OnlinePDFLoader(BaseLoader):
|
||||
"""Load documents."""
|
||||
r = requests.get(self.web_path)
|
||||
with tempfile.TemporaryDirectory() as temp_dir:
|
||||
file_path = f"{temp_dir}/online_file.pdf"
|
||||
file_path = Path(temp_dir) / "online_file.pdf"
|
||||
file = open(file_path, "wb")
|
||||
file.write(r.content)
|
||||
file.close()
|
||||
loader = UnstructuredPDFLoader(file_path)
|
||||
loader = UnstructuredPDFLoader(str(file_path))
|
||||
return loader.load()
|
||||
|
Loading…
Reference in New Issue
Block a user