Commit
·
0a67726
1
Parent(s):
d38ad4b
Update app.py
Browse files
app.py
CHANGED
@@ -4,10 +4,13 @@ import torch
|
|
4 |
from PIL import Image
|
5 |
|
6 |
# Load the BLIP-2 model and processor
|
|
|
7 |
processor = AutoProcessor.from_pretrained("Salesforce/blip2-opt-2.7b")
|
8 |
-
model = Blip2ForConditionalGeneration.from_pretrained(
|
9 |
-
|
10 |
-
|
|
|
|
|
11 |
|
12 |
# Set device to GPU if available
|
13 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
|
|
4 |
from PIL import Image
|
5 |
|
6 |
# Load the BLIP-2 model and processor
|
7 |
+
# Load the BLIP-2 model and processor without int8 quantization
|
8 |
processor = AutoProcessor.from_pretrained("Salesforce/blip2-opt-2.7b")
|
9 |
+
model = Blip2ForConditionalGeneration.from_pretrained("Salesforce/blip2-opt-2.7b").to(device)
|
10 |
+
|
11 |
+
|
12 |
+
|
13 |
+
|
14 |
|
15 |
# Set device to GPU if available
|
16 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|