thomasht86 commited on
Commit
87544bc
·
verified ·
1 Parent(s): 4775a9f

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. backend/colpali.py +2 -1
  2. frontend/app.py +1 -1
backend/colpali.py CHANGED
@@ -471,8 +471,9 @@ async def query_vespa_nearest_neighbor(
471
 
472
  def is_special_token(token: str) -> bool:
473
  # Pattern for tokens that start with '<', numbers, whitespace, or single characters, or the string 'Question'
 
474
  pattern = re.compile(r"^<.*$|^\d+$|^\s+$|^\w$|^Question$")
475
- if pattern.match(token):
476
  return True
477
  return False
478
 
 
471
 
472
  def is_special_token(token: str) -> bool:
473
  # Pattern for tokens that start with '<', numbers, whitespace, or single characters, or the string 'Question'
474
+ # Will exclude these tokens from the similarity map generation
475
  pattern = re.compile(r"^<.*$|^\d+$|^\s+$|^\w$|^Question$")
476
+ if (len(token) < 3) or pattern.match(token):
477
  return True
478
  return False
479
 
frontend/app.py CHANGED
@@ -279,7 +279,7 @@ def SearchResult(results: list, query_id: Optional[str] = None):
279
  ),
280
  Div(
281
  Badge(
282
- "Relevance score: " + str(result["relevance"]),
283
  cls="flex gap-1.5 items-center justify-center",
284
  ),
285
  ),
 
279
  ),
280
  Div(
281
  Badge(
282
+ f"Relevance score: {result['relevance']:.4f}",
283
  cls="flex gap-1.5 items-center justify-center",
284
  ),
285
  ),