Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -11,7 +11,9 @@ blip_model = BlipForConditionalGeneration.from_pretrained("Salesforce/blip-image
|
|
11 |
translator_tokenizer = NllbTokenizer.from_pretrained("facebook/nllb-200-distilled-600M")
|
12 |
translator_model = AutoModelForSeq2SeqLM.from_pretrained("facebook/nllb-200-distilled-600M")
|
13 |
lang_code = "vie_Latn"
|
14 |
-
|
|
|
|
|
15 |
|
16 |
def caption_translate(image):
|
17 |
# Step 1: Get English caption
|
|
|
11 |
translator_tokenizer = NllbTokenizer.from_pretrained("facebook/nllb-200-distilled-600M")
|
12 |
translator_model = AutoModelForSeq2SeqLM.from_pretrained("facebook/nllb-200-distilled-600M")
|
13 |
lang_code = "vie_Latn"
|
14 |
+
|
15 |
+
# Manually map lang_code to token ID (based on tokenizer's config)
|
16 |
+
lang_token_id = translator_tokenizer.convert_tokens_to_ids(lang_code)
|
17 |
|
18 |
def caption_translate(image):
|
19 |
# Step 1: Get English caption
|