Update app.py
Browse files
app.py
CHANGED
@@ -43,7 +43,7 @@ def analyze_image(image, model):
|
|
43 |
pass
|
44 |
|
45 |
def image_qa_app(kbvqa):
|
46 |
-
# Initialize session state for storing the current image and its Q&A history
|
47 |
if 'current_image' not in st.session_state:
|
48 |
st.session_state['current_image'] = None
|
49 |
if 'qa_history' not in st.session_state:
|
@@ -75,6 +75,12 @@ def image_qa_app(kbvqa):
|
|
75 |
st.session_state['analysis_done'] = False
|
76 |
st.session_state['answer_in_progress'] = False
|
77 |
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
# Analyze Image button
|
79 |
if st.session_state.get('current_image') and not st.session_state['analysis_done']:
|
80 |
if st.button('Analyze Image'):
|
@@ -83,10 +89,6 @@ def image_qa_app(kbvqa):
|
|
83 |
st.session_state['analysis_done'] = True
|
84 |
st.session_state['processed_image'] = copy.deepcopy(st.session_state['current_image'])
|
85 |
|
86 |
-
# Display the current image (unaltered)
|
87 |
-
if st.session_state.get('current_image'):
|
88 |
-
st.image(st.session_state['current_image'], caption='Uploaded Image.', use_column_width=True)
|
89 |
-
|
90 |
# Get Answer button
|
91 |
if st.session_state['analysis_done'] and not st.session_state['answer_in_progress']:
|
92 |
question = st.text_input("Ask a question about this image:")
|
|
|
43 |
pass
|
44 |
|
45 |
def image_qa_app(kbvqa):
|
46 |
+
# Initialize session state for storing the current image and its Q&A history.
|
47 |
if 'current_image' not in st.session_state:
|
48 |
st.session_state['current_image'] = None
|
49 |
if 'qa_history' not in st.session_state:
|
|
|
75 |
st.session_state['analysis_done'] = False
|
76 |
st.session_state['answer_in_progress'] = False
|
77 |
|
78 |
+
|
79 |
+
|
80 |
+
# Display the current image (unaltered)
|
81 |
+
if st.session_state.get('current_image'):
|
82 |
+
st.image(st.session_state['current_image'], caption='Uploaded Image.', use_column_width=True)
|
83 |
+
|
84 |
# Analyze Image button
|
85 |
if st.session_state.get('current_image') and not st.session_state['analysis_done']:
|
86 |
if st.button('Analyze Image'):
|
|
|
89 |
st.session_state['analysis_done'] = True
|
90 |
st.session_state['processed_image'] = copy.deepcopy(st.session_state['current_image'])
|
91 |
|
|
|
|
|
|
|
|
|
92 |
# Get Answer button
|
93 |
if st.session_state['analysis_done'] and not st.session_state['answer_in_progress']:
|
94 |
question = st.text_input("Ask a question about this image:")
|