Update app.py
Browse files
app.py
CHANGED
|
@@ -693,7 +693,7 @@ def main():
|
|
| 693 |
|
| 694 |
# Store caption but don't display it yet
|
| 695 |
|
| 696 |
-
|
| 697 |
if st.session_state.clip_model_loaded:
|
| 698 |
try:
|
| 699 |
with st.spinner("Analyzing image with CLIP model..."):
|
|
@@ -748,8 +748,6 @@ def main():
|
|
| 748 |
st.session_state.blip_model
|
| 749 |
)
|
| 750 |
st.session_state.gradcam_caption = gradcam_caption
|
| 751 |
-
|
| 752 |
-
# Store caption but don't display it yet
|
| 753 |
|
| 754 |
# Save results in session state for LLM analysis
|
| 755 |
st.session_state.current_image = image
|
|
@@ -762,4 +760,6 @@ def main():
|
|
| 762 |
except Exception as e:
|
| 763 |
st.error(f"Error analyzing image: {str(e)}")
|
| 764 |
import traceback
|
| 765 |
-
st.error(traceback.format_exc())
|
|
|
|
|
|
|
|
|
| 693 |
|
| 694 |
# Store caption but don't display it yet
|
| 695 |
|
| 696 |
+
# Detect with CLIP model if loaded
|
| 697 |
if st.session_state.clip_model_loaded:
|
| 698 |
try:
|
| 699 |
with st.spinner("Analyzing image with CLIP model..."):
|
|
|
|
| 748 |
st.session_state.blip_model
|
| 749 |
)
|
| 750 |
st.session_state.gradcam_caption = gradcam_caption
|
|
|
|
|
|
|
| 751 |
|
| 752 |
# Save results in session state for LLM analysis
|
| 753 |
st.session_state.current_image = image
|
|
|
|
| 760 |
except Exception as e:
|
| 761 |
st.error(f"Error analyzing image: {str(e)}")
|
| 762 |
import traceback
|
| 763 |
+
st.error(traceback.format_exc())
|
| 764 |
+
else:
|
| 765 |
+
st.warning("⚠️ Please load the CLIP model first to perform initial detection.")
|