Spaces:
Running
Running
File size: 1,031 Bytes
4225666 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | from app.services.ingestion_service import ingestion_service
from app.api.dependencies import get_rag_service
from pathlib import Path
from langchain_community.document_loaders import PyPDFLoader
from langchain_community.document_loaders import PyMuPDFLoader
# with open("tang24c.pdf", "rb") as f:
# file_content = f.read()
# with open("demo.pdf", "wb") as f2:
# f2.write(file_content)
file_path = Path("Script.pdf")
obj = get_rag_service()
print(obj.ingest_documents("Script.pdf"))
# documents = ingestion_service.load_file(file_path)
# print(len(documents))
# file_service.write_file(file_path=file_path, content=content)
# # 1. Write a file with some metadata
# my_file = Path("tang24c.pdf")
# file_service.write_file(my_file, "Hello VGEC!", metadata={"type": "text", "important": True})
# # 2. Get the metadata back later
# metadata = file_service.get_record("tang24c.pdf")
# print(metadata) # Output: {'type': 'text', 'important': True}
# # 3. List everything we know
# all_records = file_service.get_records()
|