Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -11,9 +11,12 @@ from transformers import (
|
|
| 11 |
BlipProcessor,
|
| 12 |
BlipForConditionalGeneration,
|
| 13 |
AutoTokenizer,
|
| 14 |
-
AutoModelForSeq2SeqLM
|
|
|
|
|
|
|
| 15 |
)
|
| 16 |
|
|
|
|
| 17 |
from PIL import Image
|
| 18 |
import torch
|
| 19 |
|
|
@@ -38,8 +41,9 @@ processor = BlipProcessor.from_pretrained("Salesforce/blip-image-captioning-larg
|
|
| 38 |
model = BlipForConditionalGeneration.from_pretrained("Salesforce/blip-image-captioning-large")
|
| 39 |
|
| 40 |
#Load transformer for translating captions from English to Spanish
|
| 41 |
-
|
| 42 |
-
|
|
|
|
| 43 |
|
| 44 |
|
| 45 |
|
|
|
|
| 11 |
BlipProcessor,
|
| 12 |
BlipForConditionalGeneration,
|
| 13 |
AutoTokenizer,
|
| 14 |
+
AutoModelForSeq2SeqLM,
|
| 15 |
+
MarianMTModel,
|
| 16 |
+
MarianTokenizer
|
| 17 |
)
|
| 18 |
|
| 19 |
+
|
| 20 |
from PIL import Image
|
| 21 |
import torch
|
| 22 |
|
|
|
|
| 41 |
model = BlipForConditionalGeneration.from_pretrained("Salesforce/blip-image-captioning-large")
|
| 42 |
|
| 43 |
#Load transformer for translating captions from English to Spanish
|
| 44 |
+
model_name = "pytorch-models/opus-mt-tc-big-en-es"
|
| 45 |
+
trans_tokenizer = MarianTokenizer.from_pretrained(model_name)
|
| 46 |
+
trans_model = MarianMTModel.from_pretrained(model_name)
|
| 47 |
|
| 48 |
|
| 49 |
|