Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,7 +3,7 @@ import torch
|
|
| 3 |
import os
|
| 4 |
import tempfile
|
| 5 |
from huggingface_hub import login
|
| 6 |
-
from transformers import AutoProcessor, AutoModelForVisualQuestionAnswering, infer_device,
|
| 7 |
from accelerate import Accelerator
|
| 8 |
|
| 9 |
# Set the device
|
|
@@ -37,12 +37,9 @@ def process_image(image, prompt):
|
|
| 37 |
|
| 38 |
# MODEL 2: PaliGemma ---
|
| 39 |
|
| 40 |
-
|
| 41 |
processor2 = AutoProcessor.from_pretrained("google/paligemma-3b-pt-224")
|
| 42 |
-
model2 =
|
| 43 |
-
model2_id,
|
| 44 |
-
torch_dtype=torch.bfloat16
|
| 45 |
-
).to(device)
|
| 46 |
|
| 47 |
|
| 48 |
# Define inference function for Model 2
|
|
|
|
| 3 |
import os
|
| 4 |
import tempfile
|
| 5 |
from huggingface_hub import login
|
| 6 |
+
from transformers import AutoProcessor, AutoModelForVisualQuestionAnswering, infer_device, pipeline
|
| 7 |
from accelerate import Accelerator
|
| 8 |
|
| 9 |
# Set the device
|
|
|
|
| 37 |
|
| 38 |
# MODEL 2: PaliGemma ---
|
| 39 |
|
| 40 |
+
|
| 41 |
processor2 = AutoProcessor.from_pretrained("google/paligemma-3b-pt-224")
|
| 42 |
+
model2 = pipeline("image-to-text", model="merve/paligemma_vqav2")
|
|
|
|
|
|
|
|
|
|
| 43 |
|
| 44 |
|
| 45 |
# Define inference function for Model 2
|