CosmoAI commited on
Commit
c96df93
·
1 Parent(s): 3ae9a9b
Files changed (1) hide show
  1. Home.py +6 -5
Home.py CHANGED
@@ -14,10 +14,12 @@ visualqna = pipeline(model="dandelin/vilt-b32-finetuned-vqa")
14
 
15
  def load_image():
16
  with st.sidebar:
17
- img = st.text_input("Enter Image URL")
18
- if st.button("Load Image"):
19
- st.write("Image Uploaded!")
20
- # st.image(img)
 
 
21
  return img
22
 
23
  # def homepage():
@@ -81,7 +83,6 @@ def load_image():
81
  def visual_qna():
82
  st.title("Visual Q&A")
83
  img = load_image()
84
- st.image(img)
85
  if img:
86
  if query := st.chat_input("Enter your message"):
87
  response = visualqna(question=query, image=img)
 
14
 
15
  def load_image():
16
  with st.sidebar:
17
+ if img := st.text_input("Enter Image URL") or st.selectbox("Select Image", ("Upload Image", "Cancel")):
18
+ if st.button("Load Image"):
19
+ st.write("Image Uploaded!")
20
+ st.image(img)
21
+ else:
22
+ st.warning("Please enter an image URL and click 'Load Image' before asking a question.")
23
  return img
24
 
25
  # def homepage():
 
83
  def visual_qna():
84
  st.title("Visual Q&A")
85
  img = load_image()
 
86
  if img:
87
  if query := st.chat_input("Enter your message"):
88
  response = visualqna(question=query, image=img)