Spaces:
Runtime error
Runtime error
Update flask_app.py
Browse files- flask_app.py +2 -2
flask_app.py
CHANGED
|
@@ -29,7 +29,7 @@ from deep_translator import GoogleTranslator
|
|
| 29 |
#print(device)
|
| 30 |
# text to image
|
| 31 |
model_url = 'https://storage.googleapis.com/sfr-vision-language-research/BLIP/models/model_base_retrieval_coco.pth'
|
| 32 |
-
|
| 33 |
|
| 34 |
|
| 35 |
|
|
@@ -154,7 +154,7 @@ def img_text():
|
|
| 154 |
|
| 155 |
model = blip_itm(pretrained=model_url, image_size=image_size, vit='base')
|
| 156 |
model.eval()
|
| 157 |
-
|
| 158 |
#model = model.to(device='cpu')
|
| 159 |
#model = model.to('cuda')
|
| 160 |
|
|
|
|
| 29 |
#print(device)
|
| 30 |
# text to image
|
| 31 |
model_url = 'https://storage.googleapis.com/sfr-vision-language-research/BLIP/models/model_base_retrieval_coco.pth'
|
| 32 |
+
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 33 |
|
| 34 |
|
| 35 |
|
|
|
|
| 154 |
|
| 155 |
model = blip_itm(pretrained=model_url, image_size=image_size, vit='base')
|
| 156 |
model.eval()
|
| 157 |
+
|
| 158 |
#model = model.to(device='cpu')
|
| 159 |
#model = model.to('cuda')
|
| 160 |
|