Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -89,15 +89,21 @@ def image_qa_app(kbvqa_model):
|
|
| 89 |
UIComponents.display_image_selection(sample_images)
|
| 90 |
|
| 91 |
uploaded_image = st.file_uploader("Or upload an Image", type=["png", "jpg", "jpeg"])
|
| 92 |
-
|
| 93 |
if uploaded_image is not None:
|
| 94 |
st.session_state['current_image'] = Image.open(uploaded_image)
|
| 95 |
st.session_state['qa_history'] = []
|
| 96 |
st.session_state['analysis_done'] = False
|
| 97 |
st.session_state['answer_in_progress'] = False
|
| 98 |
|
|
|
|
|
|
|
| 99 |
UIComponents.display_image(st.session_state['current_image'])
|
| 100 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
if st.session_state.get('current_image') and not st.session_state.get('analysis_done', False):
|
| 102 |
if st.button('Analyze Image'):
|
| 103 |
caption, detected_objects_str = ImageHandler.analyze_image(st.session_state['current_image'], kbvqa_model)
|
|
|
|
| 89 |
UIComponents.display_image_selection(sample_images)
|
| 90 |
|
| 91 |
uploaded_image = st.file_uploader("Or upload an Image", type=["png", "jpg", "jpeg"])
|
| 92 |
+
|
| 93 |
if uploaded_image is not None:
|
| 94 |
st.session_state['current_image'] = Image.open(uploaded_image)
|
| 95 |
st.session_state['qa_history'] = []
|
| 96 |
st.session_state['analysis_done'] = False
|
| 97 |
st.session_state['answer_in_progress'] = False
|
| 98 |
|
| 99 |
+
# Display the image if it's in the session state
|
| 100 |
+
if 'current_image' in st.session_state:
|
| 101 |
UIComponents.display_image(st.session_state['current_image'])
|
| 102 |
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
|
| 106 |
+
|
| 107 |
if st.session_state.get('current_image') and not st.session_state.get('analysis_done', False):
|
| 108 |
if st.button('Analyze Image'):
|
| 109 |
caption, detected_objects_str = ImageHandler.analyze_image(st.session_state['current_image'], kbvqa_model)
|