Commit
·
3bf36bd
1
Parent(s):
58bb7b3
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,14 +10,6 @@ model = Blip2ForConditionalGeneration.from_pretrained(
|
|
| 10 |
"Salesforce/blip2-opt-2.7b", load_in_8bit=True, device_map='auto'
|
| 11 |
)
|
| 12 |
|
| 13 |
-
# Set device to GPU if available
|
| 14 |
-
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 15 |
-
model.to(device)
|
| 16 |
-
|
| 17 |
-
# Set device to GPU if available
|
| 18 |
-
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 19 |
-
model.to(device)
|
| 20 |
-
|
| 21 |
def blip2_interface(image, prompted_caption_text, vqa_question, chat_context):
|
| 22 |
# Prepare image input
|
| 23 |
image_input = Image.fromarray(image).convert('RGB')
|
|
|
|
| 10 |
"Salesforce/blip2-opt-2.7b", load_in_8bit=True, device_map='auto'
|
| 11 |
)
|
| 12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
def blip2_interface(image, prompted_caption_text, vqa_question, chat_context):
|
| 14 |
# Prepare image input
|
| 15 |
image_input = Image.fromarray(image).convert('RGB')
|