Spaces:
Running
on
Zero
Running
on
Zero
ahmed-masry
commited on
Commit
•
82cf8b3
1
Parent(s):
890f3ba
Update app.py
Browse files
app.py
CHANGED
@@ -3,7 +3,8 @@ import spaces
|
|
3 |
|
4 |
import gradio as gr
|
5 |
import torch
|
6 |
-
from
|
|
|
7 |
from colpali_engine.trainer.retrieval_evaluator import CustomEvaluator
|
8 |
from colpali_engine.utils.colpali_processing_utils import (
|
9 |
process_images,
|
@@ -16,16 +17,15 @@ from tqdm import tqdm
|
|
16 |
from transformers import AutoProcessor
|
17 |
|
18 |
# Load model
|
19 |
-
model_name = "
|
20 |
token = os.environ.get("HF_TOKEN")
|
21 |
-
model =
|
22 |
-
|
23 |
|
24 |
-
model.load_adapter(model_name)
|
25 |
model = model.eval()
|
26 |
-
processor =
|
27 |
|
28 |
-
mock_image = Image.new("RGB", (
|
29 |
|
30 |
|
31 |
@spaces.GPU
|
|
|
3 |
|
4 |
import gradio as gr
|
5 |
import torch
|
6 |
+
from .modeling_colflor import ColFlor
|
7 |
+
from .processing_colflor import ColFlorProcessor
|
8 |
from colpali_engine.trainer.retrieval_evaluator import CustomEvaluator
|
9 |
from colpali_engine.utils.colpali_processing_utils import (
|
10 |
process_images,
|
|
|
17 |
from transformers import AutoProcessor
|
18 |
|
19 |
# Load model
|
20 |
+
model_name = "ahmed-masry/ColFlor"
|
21 |
token = os.environ.get("HF_TOKEN")
|
22 |
+
model = ColFlor.from_pretrained(
|
23 |
+
model_name, torch_dtype=torch.bfloat16, device_map="cuda", token = token).eval()
|
24 |
|
|
|
25 |
model = model.eval()
|
26 |
+
processor = ColFlorProcessor.from_pretrained(model_name, token = token)
|
27 |
|
28 |
+
mock_image = Image.new("RGB", (768, 768), (255, 255, 255))
|
29 |
|
30 |
|
31 |
@spaces.GPU
|