CosmoAI commited on
Commit
3bf4f99
·
1 Parent(s): 6e15e69

Update Home.py

Browse files
Files changed (1) hide show
  1. Home.py +9 -4
Home.py CHANGED
@@ -11,6 +11,13 @@ from transformers import pipeline, Conversation
11
  visualqna = pipeline(task="vqa", model="microsoft/DialoGPT-medium")
12
 
13
 
 
 
 
 
 
 
 
14
  # def homepage():
15
  # st.write("Timeline")
16
  # # allmessages =[]
@@ -71,11 +78,9 @@ visualqna = pipeline(task="vqa", model="microsoft/DialoGPT-medium")
71
 
72
  def visual_qna():
73
  st.title("Visual Q&A")
74
- with st.sidebar:
75
- if img := st.text_input("Enter Image URL"):
76
- st.image(img)
77
  if query := st.chat_input("Enter your message"):
78
- response = visualqna(img, query)
79
  with st.chat_message("assistant"):
80
  st.write(response)
81
 
 
11
  visualqna = pipeline(task="vqa", model="microsoft/DialoGPT-medium")
12
 
13
 
14
+ def load_image():
15
+ with st.sidebar:
16
+ img = st.text_input("Enter Image URL")
17
+ if st.button("Load Image"):
18
+ st.image(img)
19
+ return img
20
+
21
  # def homepage():
22
  # st.write("Timeline")
23
  # # allmessages =[]
 
78
 
79
  def visual_qna():
80
  st.title("Visual Q&A")
81
+ img = load_image()
 
 
82
  if query := st.chat_input("Enter your message"):
83
+ response = visualqna(question=query, image=img)
84
  with st.chat_message("assistant"):
85
  st.write(response)
86