Update app.py
Browse files
app.py
CHANGED
@@ -22,7 +22,7 @@ class ImageHandler:
|
|
22 |
caption = model.get_caption(img)
|
23 |
image_with_boxes, detected_objects_str = model.detect_objects(img)
|
24 |
if show_processed_image:
|
25 |
-
st.image(image_with_boxes)
|
26 |
return caption, detected_objects_str
|
27 |
|
28 |
@staticmethod
|
@@ -36,7 +36,7 @@ class QuestionAnswering:
|
|
36 |
@staticmethod
|
37 |
def answer_question(image, question, caption, detected_objects_str, model):
|
38 |
answer = model.generate_answer(question, caption, detected_objects_str)
|
39 |
-
st.image(image)
|
40 |
st.write(caption)
|
41 |
st.write("----------------")
|
42 |
st.write(detected_objects_str)
|
@@ -58,7 +58,7 @@ class UIComponents:
|
|
58 |
|
59 |
@staticmethod
|
60 |
def display_image(img):
|
61 |
-
st.image(img)
|
62 |
|
63 |
def load_kbvqa_model(detection_model):
|
64 |
"""Load KBVQA Model based on the selected detection model."""
|
@@ -100,6 +100,9 @@ def image_qa_app(kbvqa_model):
|
|
100 |
if 'current_image' in st.session_state:
|
101 |
UIComponents.display_image(st.session_state['current_image'])
|
102 |
|
|
|
|
|
|
|
103 |
|
104 |
|
105 |
|
|
|
22 |
caption = model.get_caption(img)
|
23 |
image_with_boxes, detected_objects_str = model.detect_objects(img)
|
24 |
if show_processed_image:
|
25 |
+
st.image(image_with_boxes, use_column_width=True)
|
26 |
return caption, detected_objects_str
|
27 |
|
28 |
@staticmethod
|
|
|
36 |
@staticmethod
|
37 |
def answer_question(image, question, caption, detected_objects_str, model):
|
38 |
answer = model.generate_answer(question, caption, detected_objects_str)
|
39 |
+
st.image(image, use_column_width=True)
|
40 |
st.write(caption)
|
41 |
st.write("----------------")
|
42 |
st.write(detected_objects_str)
|
|
|
58 |
|
59 |
@staticmethod
|
60 |
def display_image(img):
|
61 |
+
st.image(img, use_column_width=True)
|
62 |
|
63 |
def load_kbvqa_model(detection_model):
|
64 |
"""Load KBVQA Model based on the selected detection model."""
|
|
|
100 |
if 'current_image' in st.session_state:
|
101 |
UIComponents.display_image(st.session_state['current_image'])
|
102 |
|
103 |
+
else:
|
104 |
+
st.write("image not uploaded properly")
|
105 |
+
|
106 |
|
107 |
|
108 |
|