Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -2,7 +2,7 @@ import streamlit as st
|
|
2 |
import torch
|
3 |
from PIL import Image
|
4 |
from transformers import VisionEncoderDecoderModel, ViTFeatureExtractor, AutoTokenizer
|
5 |
-
@st.
|
6 |
def load_models():
|
7 |
model = VisionEncoderDecoderModel.from_pretrained("nlpconnect/vit-gpt2-image-captioning")
|
8 |
feature_extractor = ViTFeatureExtractor.from_pretrained("nlpconnect/vit-gpt2-image-captioning")
|
|
|
2 |
import torch
|
3 |
from PIL import Image
|
4 |
from transformers import VisionEncoderDecoderModel, ViTFeatureExtractor, AutoTokenizer
|
5 |
+
@st.cache
|
6 |
def load_models():
|
7 |
model = VisionEncoderDecoderModel.from_pretrained("nlpconnect/vit-gpt2-image-captioning")
|
8 |
feature_extractor = ViTFeatureExtractor.from_pretrained("nlpconnect/vit-gpt2-image-captioning")
|