Update app.py
Browse files
app.py
CHANGED
@@ -1,16 +1,16 @@
|
|
1 |
import streamlit as st
|
2 |
from transformers import pipeline
|
3 |
|
4 |
-
classifier = pipeline("
|
5 |
def main():
|
6 |
-
st.title("
|
7 |
|
8 |
with st.form("text_field"):
|
9 |
-
|
10 |
# clicked==True only when the button is clicked
|
11 |
clicked = st.form_submit_button("Submit")
|
12 |
if clicked:
|
13 |
-
results = classifier([
|
14 |
st.json(results)
|
15 |
|
16 |
if __name__ == "__main__":
|
|
|
1 |
import streamlit as st
|
2 |
from transformers import pipeline
|
3 |
|
4 |
+
classifier = pipeline("image-to-text", model="nlpconnect/vit-gpt2-image-captioning")
|
5 |
def main():
|
6 |
+
st.title("image-to-text")
|
7 |
|
8 |
with st.form("text_field"):
|
9 |
+
image = st.file_uploader('Choose a file')
|
10 |
# clicked==True only when the button is clicked
|
11 |
clicked = st.form_submit_button("Submit")
|
12 |
if clicked:
|
13 |
+
results = classifier([image])
|
14 |
st.json(results)
|
15 |
|
16 |
if __name__ == "__main__":
|