Spaces:
Running
Running
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# app.py
|
2 |
+
import gradio as gr
|
3 |
+
from colpali_engine.models import ColQwen2, ColQwen2Processor
|
4 |
+
import torch
|
5 |
+
import base64
|
6 |
+
from PIL import Image
|
7 |
+
import io
|
8 |
+
|
9 |
+
# Initialize model
|
10 |
+
model = ColQwen2.from_pretrained(
|
11 |
+
"vidore/colqwen2-v0.1",
|
12 |
+
torch_dtype=torch.bfloat16,
|
13 |
+
device_map="auto",
|
14 |
+
)
|
15 |
+
processor = ColQwen2Processor.from_pretrained("vidore/colqwen2-v0.1")
|
16 |
+
model = model.eval()
|