Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -18,6 +18,7 @@ from varag.utils import get_model_colpali
|
|
| 18 |
import argparse
|
| 19 |
import spaces
|
| 20 |
import torch
|
|
|
|
| 21 |
|
| 22 |
load_dotenv()
|
| 23 |
|
|
@@ -39,7 +40,7 @@ image_embedding_model = SentenceTransformer(
|
|
| 39 |
)
|
| 40 |
colpali_model, colpali_processor = get_model_colpali("vidore/colpali-v1.2")
|
| 41 |
|
| 42 |
-
|
| 43 |
|
| 44 |
# Initialize RAG instances
|
| 45 |
simple_rag = SimpleRAG(
|
|
@@ -66,7 +67,7 @@ hybrid_rag = HybridColpaliRAG(
|
|
| 66 |
IngestResult = namedtuple("IngestResult", ["status_text", "progress_table"])
|
| 67 |
|
| 68 |
|
| 69 |
-
@spaces.GPU
|
| 70 |
def ingest_data(pdf_files, use_ocr, chunk_size, progress=gr.Progress()):
|
| 71 |
file_paths = [pdf_file.name for pdf_file in pdf_files]
|
| 72 |
total_start_time = time.time()
|
|
@@ -156,7 +157,7 @@ def ingest_data(pdf_files, use_ocr, chunk_size, progress=gr.Progress()):
|
|
| 156 |
)
|
| 157 |
|
| 158 |
|
| 159 |
-
@spaces.GPU
|
| 160 |
def retrieve_data(query, top_k, sequential=False):
|
| 161 |
results = {}
|
| 162 |
timings = {}
|
|
|
|
| 18 |
import argparse
|
| 19 |
import spaces
|
| 20 |
import torch
|
| 21 |
+
from docling.document_converter import DocumentConverter
|
| 22 |
|
| 23 |
load_dotenv()
|
| 24 |
|
|
|
|
| 40 |
)
|
| 41 |
colpali_model, colpali_processor = get_model_colpali("vidore/colpali-v1.2")
|
| 42 |
|
| 43 |
+
converter = DocumentConverter()
|
| 44 |
|
| 45 |
# Initialize RAG instances
|
| 46 |
simple_rag = SimpleRAG(
|
|
|
|
| 67 |
IngestResult = namedtuple("IngestResult", ["status_text", "progress_table"])
|
| 68 |
|
| 69 |
|
| 70 |
+
@spaces.GPU(duration=600)
|
| 71 |
def ingest_data(pdf_files, use_ocr, chunk_size, progress=gr.Progress()):
|
| 72 |
file_paths = [pdf_file.name for pdf_file in pdf_files]
|
| 73 |
total_start_time = time.time()
|
|
|
|
| 157 |
)
|
| 158 |
|
| 159 |
|
| 160 |
+
@spaces.GPU(duration=600)
|
| 161 |
def retrieve_data(query, top_k, sequential=False):
|
| 162 |
results = {}
|
| 163 |
timings = {}
|