Spaces:
Runtime error
Runtime error
seanbenhur
commited on
Commit
•
7c672de
1
Parent(s):
7289034
Update app.py
Browse files
app.py
CHANGED
@@ -2,7 +2,7 @@ import torch
|
|
2 |
import re
|
3 |
import gradio as gr
|
4 |
from pathlib import Path
|
5 |
-
from transformers import
|
6 |
|
7 |
def predict(image, max_length=64, num_beams=4):
|
8 |
image = image.convert('RGB')
|
@@ -21,7 +21,7 @@ model.to(device)
|
|
21 |
print("Loaded model")
|
22 |
feature_extractor = AutoFeatureExtractor.from_pretrained("google/vit-base-patch16-224-in21k")
|
23 |
print("Loaded feature_extractor")
|
24 |
-
tokenizer =
|
25 |
print("Loaded tokenizer")
|
26 |
title = "Hindi Image Captioning"
|
27 |
description = ""
|
|
|
2 |
import re
|
3 |
import gradio as gr
|
4 |
from pathlib import Path
|
5 |
+
from transformers import GPT2Tokenizer, AutoFeatureExtractor, VisionEncoderDecoderModel
|
6 |
|
7 |
def predict(image, max_length=64, num_beams=4):
|
8 |
image = image.convert('RGB')
|
|
|
21 |
print("Loaded model")
|
22 |
feature_extractor = AutoFeatureExtractor.from_pretrained("google/vit-base-patch16-224-in21k")
|
23 |
print("Loaded feature_extractor")
|
24 |
+
tokenizer = GPT2Tokenizer.from_pretrained(model_path)
|
25 |
print("Loaded tokenizer")
|
26 |
title = "Hindi Image Captioning"
|
27 |
description = ""
|