Spaces:
Sleeping
Sleeping
refactor
Browse files
src/colpali/visualizer.py
CHANGED
|
@@ -4,15 +4,15 @@ ColPali Visualization Module
|
|
| 4 |
Generates attention/saliency maps to visualize which parts of the document
|
| 5 |
are most relevant to a query.
|
| 6 |
"""
|
|
|
|
|
|
|
| 7 |
|
| 8 |
import torch
|
| 9 |
import numpy as np
|
| 10 |
-
from PIL import Image, ImageDraw, ImageFont
|
| 11 |
-
from typing import List, Dict, Any, Optional
|
| 12 |
import matplotlib.pyplot as plt
|
| 13 |
import matplotlib.patches as patches
|
|
|
|
| 14 |
from matplotlib.colors import LinearSegmentedColormap
|
| 15 |
-
import logging
|
| 16 |
|
| 17 |
|
| 18 |
logger = logging.getLogger(__name__)
|
|
@@ -231,6 +231,3 @@ def visualize_retrieval_results(
|
|
| 231 |
plt.show()
|
| 232 |
|
| 233 |
plt.close()
|
| 234 |
-
|
| 235 |
-
|
| 236 |
-
|
|
|
|
| 4 |
Generates attention/saliency maps to visualize which parts of the document
|
| 5 |
are most relevant to a query.
|
| 6 |
"""
|
| 7 |
+
import logging
|
| 8 |
+
from typing import List, Dict, Any, Optional
|
| 9 |
|
| 10 |
import torch
|
| 11 |
import numpy as np
|
|
|
|
|
|
|
| 12 |
import matplotlib.pyplot as plt
|
| 13 |
import matplotlib.patches as patches
|
| 14 |
+
from PIL import Image, ImageDraw, ImageFont
|
| 15 |
from matplotlib.colors import LinearSegmentedColormap
|
|
|
|
| 16 |
|
| 17 |
|
| 18 |
logger = logging.getLogger(__name__)
|
|
|
|
| 231 |
plt.show()
|
| 232 |
|
| 233 |
plt.close()
|
|
|
|
|
|
|
|
|