saakshigupta commited on
Commit
12cd831
·
verified ·
1 Parent(s): 023ba3f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -24
app.py CHANGED
@@ -40,22 +40,7 @@ def check_gpu():
40
  return False
41
 
42
  # Sidebar components
43
- st.sidebar.title("Options")
44
-
45
- # Fixed values for temperature and max tokens
46
- temperature = 0.7
47
- max_tokens = 500
48
-
49
- # Custom instruction text area in sidebar
50
- custom_instruction = st.sidebar.text_area(
51
- "Custom Instructions (Advanced)",
52
- value="Focus on analyzing the highlighted regions from the GradCAM visualization. Examine facial inconsistencies, lighting irregularities, and other artifacts visible in the heat map.",
53
- help="Add specific instructions for the LLM analysis"
54
- )
55
-
56
- # About section in sidebar
57
- st.sidebar.markdown("---")
58
- st.sidebar.subheader("About")
59
  st.sidebar.markdown("""
60
  This analyzer performs multi-stage detection:
61
  1. **Initial Detection**: CLIP-based classifier
@@ -72,6 +57,17 @@ The system looks for:
72
  - Blending problems
73
  """)
74
 
 
 
 
 
 
 
 
 
 
 
 
75
  # ----- GradCAM Implementation -----
76
 
77
  class ImageDataset(torch.utils.data.Dataset):
@@ -768,8 +764,6 @@ def main():
768
  # Image Analysis Summary section - AFTER Stage 2
769
  if hasattr(st.session_state, 'current_image') and (hasattr(st.session_state, 'image_caption') or hasattr(st.session_state, 'gradcam_caption')):
770
  with st.expander("Image Analysis Summary", expanded=True):
771
- st.subheader("Generated Descriptions and Analysis")
772
-
773
  # Display image, captions, and results in organized layout with proper formatting
774
  col1, col2 = st.columns([1, 2])
775
 
@@ -780,12 +774,6 @@ def main():
780
  st.image(st.session_state.current_overlay, caption="GradCAM Overlay", width=300)
781
 
782
  with col2:
783
- # Detection result
784
- if hasattr(st.session_state, 'current_pred_label'):
785
- st.markdown("### Detection Result")
786
- st.markdown(f"**Classification:** {st.session_state.current_pred_label} (Confidence: {st.session_state.current_confidence:.2%})")
787
- st.markdown("---")
788
-
789
  # Image description
790
  if hasattr(st.session_state, 'image_caption'):
791
  st.markdown("### Image Description")
 
40
  return False
41
 
42
  # Sidebar components
43
+ st.sidebar.title("About")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  st.sidebar.markdown("""
45
  This analyzer performs multi-stage detection:
46
  1. **Initial Detection**: CLIP-based classifier
 
57
  - Blending problems
58
  """)
59
 
60
+ # Fixed values for temperature and max tokens
61
+ temperature = 0.7
62
+ max_tokens = 500
63
+
64
+ # Custom instruction text area in sidebar
65
+ custom_instruction = st.sidebar.text_area(
66
+ "Custom Instructions (Advanced)",
67
+ value="Focus on analyzing the highlighted regions from the GradCAM visualization. Examine facial inconsistencies, lighting irregularities, and other artifacts visible in the heat map.",
68
+ help="Add specific instructions for the LLM analysis"
69
+ )
70
+
71
  # ----- GradCAM Implementation -----
72
 
73
  class ImageDataset(torch.utils.data.Dataset):
 
764
  # Image Analysis Summary section - AFTER Stage 2
765
  if hasattr(st.session_state, 'current_image') and (hasattr(st.session_state, 'image_caption') or hasattr(st.session_state, 'gradcam_caption')):
766
  with st.expander("Image Analysis Summary", expanded=True):
 
 
767
  # Display image, captions, and results in organized layout with proper formatting
768
  col1, col2 = st.columns([1, 2])
769
 
 
774
  st.image(st.session_state.current_overlay, caption="GradCAM Overlay", width=300)
775
 
776
  with col2:
 
 
 
 
 
 
777
  # Image description
778
  if hasattr(st.session_state, 'image_caption'):
779
  st.markdown("### Image Description")