Spaces:
Running
Running
rename
Browse files
tool.py
CHANGED
|
@@ -238,7 +238,7 @@ class VisualRAGTool(Tool):
|
|
| 238 |
|
| 239 |
return pages
|
| 240 |
|
| 241 |
-
def
|
| 242 |
"""Embeds the images using the model."""
|
| 243 |
"""Example script to run inference with ColPali (ColQwen2)"""
|
| 244 |
# run inference - docs
|
|
@@ -268,7 +268,7 @@ class VisualRAGTool(Tool):
|
|
| 268 |
pgs = self.preprocess(files, contextualize=contextualize, api_key=api_key or self.api_key)
|
| 269 |
|
| 270 |
# Embed the images
|
| 271 |
-
embds = self.
|
| 272 |
|
| 273 |
# Overwrite the database if necessary
|
| 274 |
if overwrite_db:
|
|
|
|
| 238 |
|
| 239 |
return pages
|
| 240 |
|
| 241 |
+
def compute_embeddings(self, pages: List[Page]) -> List[torch.Tensor]:
|
| 242 |
"""Embeds the images using the model."""
|
| 243 |
"""Example script to run inference with ColPali (ColQwen2)"""
|
| 244 |
# run inference - docs
|
|
|
|
| 268 |
pgs = self.preprocess(files, contextualize=contextualize, api_key=api_key or self.api_key)
|
| 269 |
|
| 270 |
# Embed the images
|
| 271 |
+
embds = self.compute_embeddings(pgs)
|
| 272 |
|
| 273 |
# Overwrite the database if necessary
|
| 274 |
if overwrite_db:
|