mirror of
https://github.com/VectifyAI/PageIndex.git
synced 2026-07-24 21:41:04 +02:00
chore: check PAGEINDEX_API_KEY before downloading the demo PDF
This commit is contained in:
parent
3c8214a321
commit
64c468c006
1 changed files with 4 additions and 3 deletions
|
|
@ -23,6 +23,10 @@ _EXAMPLES_DIR = Path(__file__).parent
|
|||
PDF_URL = "https://arxiv.org/pdf/2603.15031"
|
||||
PDF_PATH = _EXAMPLES_DIR / "documents" / "attention-residuals.pdf"
|
||||
|
||||
api_key = os.environ.get("PAGEINDEX_API_KEY")
|
||||
if not api_key:
|
||||
sys.exit("PAGEINDEX_API_KEY not set — get a key at https://dash.pageindex.ai")
|
||||
|
||||
# Download PDF if needed
|
||||
if not PDF_PATH.exists():
|
||||
print(f"Downloading {PDF_URL} ...")
|
||||
|
|
@ -35,9 +39,6 @@ if not PDF_PATH.exists():
|
|||
f.write(chunk)
|
||||
print("Download complete.\n")
|
||||
|
||||
api_key = os.environ.get("PAGEINDEX_API_KEY")
|
||||
if not api_key:
|
||||
sys.exit("PAGEINDEX_API_KEY not set — get a key at https://dash.pageindex.ai")
|
||||
client = CloudClient(api_key=api_key)
|
||||
collection = client.collection()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue