Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -7,6 +7,9 @@ from transformers import VisionEncoderDecoderModel, ViTFeatureExtractor, AutoTok
|
|
7 |
print("="*150)
|
8 |
print("MODEL LOADED")
|
9 |
st.title("img_captioning_app")
|
|
|
|
|
|
|
10 |
#st.text("Build with Streamlit and OpenCV")
|
11 |
if "photo" not in st.session_state:
|
12 |
st.session_state["photo"]="not done"
|
@@ -28,9 +31,6 @@ camera_photo = c2.camera_input("Take a photo", on_change=change_photo_state)
|
|
28 |
if choice == 'Caption':
|
29 |
#st.subheader("Detection")
|
30 |
if st.session_state["photo"]=="done":
|
31 |
-
model = VisionEncoderDecoderModel.from_pretrained("nlpconnect/vit-gpt2-image-captioning")
|
32 |
-
feature_extractor = ViTFeatureExtractor.from_pretrained("nlpconnect/vit-gpt2-image-captioning")
|
33 |
-
tokenizer = AutoTokenizer.from_pretrained("nlpconnect/vit-gpt2-image-captioning")
|
34 |
if uploaded_photo:
|
35 |
our_image= load_image(uploaded_photo)
|
36 |
elif camera_photo:
|
|
|
7 |
print("="*150)
|
8 |
print("MODEL LOADED")
|
9 |
st.title("img_captioning_app")
|
10 |
+
model = VisionEncoderDecoderModel.from_pretrained("nlpconnect/vit-gpt2-image-captioning")
|
11 |
+
feature_extractor = ViTFeatureExtractor.from_pretrained("nlpconnect/vit-gpt2-image-captioning")
|
12 |
+
tokenizer = AutoTokenizer.from_pretrained("nlpconnect/vit-gpt2-image-captioning")
|
13 |
#st.text("Build with Streamlit and OpenCV")
|
14 |
if "photo" not in st.session_state:
|
15 |
st.session_state["photo"]="not done"
|
|
|
31 |
if choice == 'Caption':
|
32 |
#st.subheader("Detection")
|
33 |
if st.session_state["photo"]=="done":
|
|
|
|
|
|
|
34 |
if uploaded_photo:
|
35 |
our_image= load_image(uploaded_photo)
|
36 |
elif camera_photo:
|