Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,17 +1,20 @@
|
|
1 |
import streamlit as st
|
2 |
from transformers import pipeline
|
|
|
3 |
|
4 |
-
|
|
|
5 |
def main():
|
6 |
st.title("Visual Question Answering")
|
7 |
|
8 |
with st.form("text_field"):
|
9 |
file = st.file_uploader("Upload image", type=["jpg", "png"])
|
10 |
-
|
|
|
11 |
# clicked==True only when the button is clicked
|
12 |
clicked = st.form_submit_button("Submit")
|
13 |
if clicked:
|
14 |
-
results = question(
|
15 |
st.json(results)
|
16 |
|
17 |
if __name__ == "__main__":
|
|
|
1 |
import streamlit as st
|
2 |
from transformers import pipeline
|
3 |
+
from PIL import Image
|
4 |
|
5 |
+
|
6 |
+
question = pipeline("question-answering")
|
7 |
def main():
|
8 |
st.title("Visual Question Answering")
|
9 |
|
10 |
with st.form("text_field"):
|
11 |
file = st.file_uploader("Upload image", type=["jpg", "png"])
|
12 |
+
image = Image.open(file)
|
13 |
+
text_input = st.text_input("Enter some question π")
|
14 |
# clicked==True only when the button is clicked
|
15 |
clicked = st.form_submit_button("Submit")
|
16 |
if clicked:
|
17 |
+
results = question(image , text)
|
18 |
st.json(results)
|
19 |
|
20 |
if __name__ == "__main__":
|