manu commited on
Commit
b5297f4
1 Parent(s): dad1e49

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -0
app.py CHANGED
@@ -7,12 +7,14 @@ from PIL import Image
7
  from torch.utils.data import DataLoader
8
  from tqdm import tqdm
9
  from transformers import AutoProcessor
 
10
 
11
  from colpali_engine.models.paligemma_colbert_architecture import ColPali
12
  from colpali_engine.trainer.retrieval_evaluator import CustomEvaluator
13
  from colpali_engine.utils.colpali_processing_utils import process_images, process_queries
14
 
15
 
 
16
  def search(query: str, ds, images):
17
  qs = []
18
  with torch.no_grad():
@@ -28,6 +30,7 @@ def search(query: str, ds, images):
28
  return f"The most relevant page is {best_page}", images[best_page]
29
 
30
 
 
31
  def index(file, ds):
32
  """Example script to run inference with ColPali"""
33
  images = []
 
7
  from torch.utils.data import DataLoader
8
  from tqdm import tqdm
9
  from transformers import AutoProcessor
10
+ import spaces
11
 
12
  from colpali_engine.models.paligemma_colbert_architecture import ColPali
13
  from colpali_engine.trainer.retrieval_evaluator import CustomEvaluator
14
  from colpali_engine.utils.colpali_processing_utils import process_images, process_queries
15
 
16
 
17
+ @spaces.GPU
18
  def search(query: str, ds, images):
19
  qs = []
20
  with torch.no_grad():
 
30
  return f"The most relevant page is {best_page}", images[best_page]
31
 
32
 
33
+ @spaces.GPU
34
  def index(file, ds):
35
  """Example script to run inference with ColPali"""
36
  images = []