Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,9 +5,9 @@ from transformers import AutoTokenizer, ViTImageProcessor, VisionEncoderDecoderM
|
|
| 5 |
device = 'cpu'
|
| 6 |
|
| 7 |
# Load the pretrained model, feature extractor, and tokenizer
|
| 8 |
-
model = VisionEncoderDecoderModel.from_pretrained("
|
| 9 |
-
feature_extractor = ViTImageProcessor.from_pretrained("
|
| 10 |
-
tokenizer = AutoTokenizer.from_pretrained("
|
| 11 |
|
| 12 |
def predict(image, max_length=64, num_beams=4):
|
| 13 |
# Process the input image
|
|
|
|
| 5 |
device = 'cpu'
|
| 6 |
|
| 7 |
# Load the pretrained model, feature extractor, and tokenizer
|
| 8 |
+
model = VisionEncoderDecoderModel.from_pretrained("premanthcharan/Image_Captioning_Model").to(device)
|
| 9 |
+
feature_extractor = ViTImageProcessor.from_pretrained("premanthcharan/Image_Captioning_Model")
|
| 10 |
+
tokenizer = AutoTokenizer.from_pretrained("premanthcharan/Image_Captioning_Model")
|
| 11 |
|
| 12 |
def predict(image, max_length=64, num_beams=4):
|
| 13 |
# Process the input image
|