JBDef commited on
Commit
1bf3e82
β€’
1 Parent(s): 991b3fe

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -1,17 +1,20 @@
1
  import streamlit as st
2
  from transformers import pipeline
 
3
 
4
- question = pipeline("vqa")
 
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
- text = st.text_area('enter some question:')
 
11
  # clicked==True only when the button is clicked
12
  clicked = st.form_submit_button("Submit")
13
  if clicked:
14
- results = question(file.name , text)
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__":