Spaces:
Configuration error
Configuration error
Update app.py
Browse files
app.py
CHANGED
|
@@ -12,12 +12,12 @@ DESCRIPTION = "# Image Captioning with LongCap"
|
|
| 12 |
|
| 13 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 14 |
|
| 15 |
-
model_id = "unography/blip-
|
| 16 |
processor = AutoProcessor.from_pretrained(model_id)
|
| 17 |
model = BlipForConditionalGeneration.from_pretrained(model_id).to(device)
|
| 18 |
|
| 19 |
|
| 20 |
-
|
| 21 |
def run(image: PIL.Image.Image) -> str:
|
| 22 |
inputs = processor(images=image, return_tensors="pt").to(device)
|
| 23 |
out = model.generate(pixel_values=inputs.pixel_values, num_beams=3, max_length=300)
|
|
|
|
| 12 |
|
| 13 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 14 |
|
| 15 |
+
model_id = "unography/blip-long-cap"
|
| 16 |
processor = AutoProcessor.from_pretrained(model_id)
|
| 17 |
model = BlipForConditionalGeneration.from_pretrained(model_id).to(device)
|
| 18 |
|
| 19 |
|
| 20 |
+
@spaces.GPU(duration=30)
|
| 21 |
def run(image: PIL.Image.Image) -> str:
|
| 22 |
inputs = processor(images=image, return_tensors="pt").to(device)
|
| 23 |
out = model.generate(pixel_values=inputs.pixel_values, num_beams=3, max_length=300)
|