Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -11,7 +11,6 @@ def load_models():
|
|
11 |
feature_extractor = ViTFeatureExtractor.from_pretrained("nlpconnect/vit-gpt2-image-captioning")
|
12 |
tokenizer = AutoTokenizer.from_pretrained("nlpconnect/vit-gpt2-image-captioning")
|
13 |
return model, feature_extractor, tokenizer
|
14 |
-
model, feature_extractor, tokenizer = load_models()
|
15 |
#st.text("Build with Streamlit and OpenCV")
|
16 |
if "photo" not in st.session_state:
|
17 |
st.session_state["photo"]="not done"
|
@@ -27,6 +26,7 @@ camera_photo = c2.camera_input("Take a photo", on_change=change_photo_state)
|
|
27 |
|
28 |
#st.subheader("Detection")
|
29 |
if st.checkbox("Generate_Caption"):
|
|
|
30 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
31 |
model.to(device)
|
32 |
max_length = 16
|
|
|
11 |
feature_extractor = ViTFeatureExtractor.from_pretrained("nlpconnect/vit-gpt2-image-captioning")
|
12 |
tokenizer = AutoTokenizer.from_pretrained("nlpconnect/vit-gpt2-image-captioning")
|
13 |
return model, feature_extractor, tokenizer
|
|
|
14 |
#st.text("Build with Streamlit and OpenCV")
|
15 |
if "photo" not in st.session_state:
|
16 |
st.session_state["photo"]="not done"
|
|
|
26 |
|
27 |
#st.subheader("Detection")
|
28 |
if st.checkbox("Generate_Caption"):
|
29 |
+
model, feature_extractor, tokenizer = load_models()
|
30 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
31 |
model.to(device)
|
32 |
max_length = 16
|