Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -14,13 +14,13 @@ CHUNK_SIZE = 2500 # Larger chunks for better context
|
|
14 |
# 🔹 Ensure Directory Exists
|
15 |
os.makedirs(PDF_DIR, exist_ok=True)
|
16 |
|
17 |
-
# 🔹
|
18 |
PDF_FILES = {
|
19 |
-
"SNAP 10 CCR 2506-1.pdf": "https://huggingface.co/spaces/tstone87/ccr-colorado/resolve/main/SNAP%2010%20CCR%202506-1%20.pdf",
|
20 |
-
"Med 10 CCR 2505-10 8.100.pdf": "https://huggingface.co/spaces/tstone87/ccr-colorado/resolve/main/Med%2010%20CCR%202505-10%208.100.pdf",
|
21 |
}
|
22 |
|
23 |
-
# 🔹 Function to Download PDFs Directly
|
24 |
def download_pdfs():
|
25 |
for filename, url in PDF_FILES.items():
|
26 |
pdf_path = os.path.join(PDF_DIR, filename)
|
@@ -28,7 +28,7 @@ def download_pdfs():
|
|
28 |
print(f"📥 Downloading {filename}...")
|
29 |
try:
|
30 |
response = requests.get(url, stream=True)
|
31 |
-
response.raise_for_status()
|
32 |
|
33 |
with open(pdf_path, "wb") as f:
|
34 |
for chunk in response.iter_content(chunk_size=8192):
|
|
|
14 |
# 🔹 Ensure Directory Exists
|
15 |
os.makedirs(PDF_DIR, exist_ok=True)
|
16 |
|
17 |
+
# 🔹 Direct URLs for PDF Downloads (with `?download=true`)
|
18 |
PDF_FILES = {
|
19 |
+
"SNAP 10 CCR 2506-1.pdf": "https://huggingface.co/spaces/tstone87/ccr-colorado/resolve/main/SNAP%2010%20CCR%202506-1%20.pdf?download=true",
|
20 |
+
"Med 10 CCR 2505-10 8.100.pdf": "https://huggingface.co/spaces/tstone87/ccr-colorado/resolve/main/Med%2010%20CCR%202505-10%208.100.pdf?download=true",
|
21 |
}
|
22 |
|
23 |
+
# 🔹 Function to Download PDFs Directly from Given URLs
|
24 |
def download_pdfs():
|
25 |
for filename, url in PDF_FILES.items():
|
26 |
pdf_path = os.path.join(PDF_DIR, filename)
|
|
|
28 |
print(f"📥 Downloading {filename}...")
|
29 |
try:
|
30 |
response = requests.get(url, stream=True)
|
31 |
+
response.raise_for_status() # Ensure the request was successful
|
32 |
|
33 |
with open(pdf_path, "wb") as f:
|
34 |
for chunk in response.iter_content(chunk_size=8192):
|