Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -155,7 +155,7 @@ def index_from_url(url: str) -> tuple[str, str]:
|
|
| 155 |
# -----------------------------
|
| 156 |
def search(query: str, k: int):
|
| 157 |
"""
|
| 158 |
-
Search the
|
| 159 |
generate an answer grounded ONLY in those pages.
|
| 160 |
|
| 161 |
MCP tool description:
|
|
@@ -174,10 +174,6 @@ def search(query: str, k: int):
|
|
| 174 |
|
| 175 |
Returns:
|
| 176 |
ai_response (str): Answer grounded only in retrieved pages, with citations (page numbers).
|
| 177 |
-
|
| 178 |
-
Notes:
|
| 179 |
-
• Requires that a PDF has been indexed first.
|
| 180 |
-
• Citations reference 1-based page numbers as shown in the gallery captions.
|
| 181 |
"""
|
| 182 |
global ds, images
|
| 183 |
|
|
@@ -243,12 +239,7 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
| 243 |
gr.Markdown("# ColPali: Efficient Document Retrieval with Vision Language Models (ColQwen2) 📚")
|
| 244 |
gr.Markdown(
|
| 245 |
"""Demo to test ColQwen2 (ColPali) on PDF documents.
|
| 246 |
-
ColPali is implemented from the [ColPali paper](https://arxiv.org/abs/2407.01449).
|
| 247 |
-
|
| 248 |
-
This demo lets you **upload a PDF or load a sample**, then **search** for the most relevant pages and get a grounded answer.
|
| 249 |
-
|
| 250 |
-
⚠️ The model was trained on A4 portrait English PDFs; performance may drop on other formats/languages.
|
| 251 |
-
"""
|
| 252 |
)
|
| 253 |
|
| 254 |
with gr.Row():
|
|
|
|
| 155 |
# -----------------------------
|
| 156 |
def search(query: str, k: int):
|
| 157 |
"""
|
| 158 |
+
Search the current database of PDF document pages for the most relevant content and
|
| 159 |
generate an answer grounded ONLY in those pages.
|
| 160 |
|
| 161 |
MCP tool description:
|
|
|
|
| 174 |
|
| 175 |
Returns:
|
| 176 |
ai_response (str): Answer grounded only in retrieved pages, with citations (page numbers).
|
|
|
|
|
|
|
|
|
|
|
|
|
| 177 |
"""
|
| 178 |
global ds, images
|
| 179 |
|
|
|
|
| 239 |
gr.Markdown("# ColPali: Efficient Document Retrieval with Vision Language Models (ColQwen2) 📚")
|
| 240 |
gr.Markdown(
|
| 241 |
"""Demo to test ColQwen2 (ColPali) on PDF documents.
|
| 242 |
+
ColPali is implemented from the [ColPali paper](https://arxiv.org/abs/2407.01449)."""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 243 |
)
|
| 244 |
|
| 245 |
with gr.Row():
|