Spaces:
Sleeping
Sleeping
RAG PDF Assistant
Initial commit: Production-ready RAG PDF Assistant with HuggingFace integration
1b31f0c Download main.py from EbiAraz/RAG-PDF-Project: direct link, hf CLI and curl.
- Browser
- Download file 561 Bytes
-
https://huggingface.co/spaces/EbiAraz/RAG-PDF-Project/resolve/main/main.py
- Command line
-
hf download hf://spaces/EbiAraz/RAG-PDF-Project/main.py
-
curl -L -o main.py https://huggingface.co/spaces/EbiAraz/RAG-PDF-Project/resolve/main/main.py
561 Bytes
| import os | |
| from ingestion.build_index import build | |
| from pipeline.rag_pipeline import rag_answer | |
| pdf_path = 'data/documents/1.pdf' | |
| if not os.path.exists(pdf_path): | |
| print(f'Error: PDF not found at "{pdf_path}". Please add the file and try again.') | |
| exit(1) | |
| print('preparing for the system ...') | |
| index, chunks = build(pdf_path) | |
| print("system is ready .enter (exit) if you've done") | |
| while True: | |
| q = input('\n question : ') | |
| if q == 'exit': | |
| break | |
| answer = rag_answer(q, index, chunks) | |
| print('\n answer : \n') | |
| print(answer) |