Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -18,6 +18,13 @@ from BLIP.models.blip import blip_decoder
|
|
| 18 |
|
| 19 |
import gradio as gr
|
| 20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
def greet(name):
|
| 22 |
return "hi " + name + "!!"
|
| 23 |
|
|
|
|
| 18 |
|
| 19 |
import gradio as gr
|
| 20 |
|
| 21 |
+
device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
|
| 22 |
+
blip_image_eval_size = 384
|
| 23 |
+
blip_model_url = 'https://storage.googleapis.com/sfr-vision-language-research/BLIP/models/model*_base_caption.pth'
|
| 24 |
+
blip_model = blip_decoder(pretrained=blip_model_url, image_size=blip_image_eval_size, vit='base')
|
| 25 |
+
blip_model.eval()
|
| 26 |
+
blip_model = blip_model.to(device)
|
| 27 |
+
|
| 28 |
def greet(name):
|
| 29 |
return "hi " + name + "!!"
|
| 30 |
|