JKrishnanandhaa commited on
Commit
e7616c0
·
verified ·
1 Parent(s): 299edf4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +43 -34
app.py CHANGED
@@ -95,57 +95,62 @@ def create_detection_metrics_gauge(avg_confidence: float, iou: float, precision:
95
 
96
  fig = go.Figure()
97
 
98
- # Add radial bars (concentric rings from outer to inner)
 
 
 
 
 
99
  # Confidence - outermost ring (blue)
100
  fig.add_trace(go.Barpolar(
101
- r=[confidence_pct],
102
- theta=[0],
103
- width=[90],
104
  name=f'Confidence: {confidence_pct:.1f}%',
105
  marker_color='#4169E1',
106
- marker_line_color='white',
107
- marker_line_width=2,
108
- opacity=0.8,
109
- base=75,
110
  ))
111
 
112
  # Precision - second ring (green)
113
  fig.add_trace(go.Barpolar(
114
- r=[precision_pct],
115
- theta=[90],
116
- width=[90],
117
  name=f'Precision: {precision_pct:.1f}%',
118
  marker_color='#5cb85c',
119
- marker_line_color='white',
120
- marker_line_width=2,
121
- opacity=0.8,
122
- base=50,
123
  ))
124
 
125
  # Recall - third ring (orange)
126
  fig.add_trace(go.Barpolar(
127
- r=[recall_pct],
128
- theta=[180],
129
- width=[90],
130
  name=f'Recall: {recall_pct:.1f}%',
131
  marker_color='#f0ad4e',
132
- marker_line_color='white',
133
- marker_line_width=2,
134
- opacity=0.8,
135
- base=25,
136
  ))
137
 
138
  # IoU - innermost ring (red)
139
  fig.add_trace(go.Barpolar(
140
- r=[iou_pct],
141
- theta=[270],
142
- width=[90],
143
  name=f'IoU: {iou_pct:.1f}%',
144
  marker_color='#d9534f',
145
- marker_line_color='white',
146
- marker_line_width=2,
147
- opacity=0.8,
148
- base=0,
149
  ))
150
 
151
  fig.update_layout(
@@ -155,7 +160,10 @@ def create_detection_metrics_gauge(avg_confidence: float, iou: float, precision:
155
  range=[0, 100],
156
  showticklabels=True,
157
  tickfont=dict(size=10),
158
- gridcolor='rgba(128,128,128,0.2)',
 
 
 
159
  ),
160
  angularaxis=dict(
161
  visible=True,
@@ -171,12 +179,13 @@ def create_detection_metrics_gauge(avg_confidence: float, iou: float, precision:
171
  y=0.5,
172
  xanchor="left",
173
  x=1.05,
174
- font=dict(size=11)
 
175
  ),
176
  paper_bgcolor='rgba(0,0,0,0)',
177
  plot_bgcolor='rgba(0,0,0,0)',
178
  height=400,
179
- margin=dict(l=40, r=120, t=40, b=40)
180
  )
181
 
182
  return fig
@@ -516,9 +525,9 @@ with gr.Blocks(css=custom_css) as demo:
516
  with gr.Column(scale=2):
517
  gr.Markdown("### Detection Results")
518
  output_image = gr.Image(label="Detected Forgeries", type="numpy")
519
-
520
- gr.Markdown("---")
521
 
 
 
522
  with gr.Row():
523
  with gr.Column(scale=1):
524
  gr.Markdown("### Analysis Report")
 
95
 
96
  fig = go.Figure()
97
 
98
+ # Define ring thickness and spacing
99
+ ring_thickness = 15
100
+
101
+ # Add radial bars as thin concentric rings (from outer to inner)
102
+ # Each ring shows the full 360° but at different radii
103
+
104
  # Confidence - outermost ring (blue)
105
  fig.add_trace(go.Barpolar(
106
+ r=[confidence_pct] * 360,
107
+ theta=list(range(360)),
108
+ width=1,
109
  name=f'Confidence: {confidence_pct:.1f}%',
110
  marker_color='#4169E1',
111
+ marker_line_color='#4169E1',
112
+ marker_line_width=0,
113
+ opacity=0.9,
114
+ base=85,
115
  ))
116
 
117
  # Precision - second ring (green)
118
  fig.add_trace(go.Barpolar(
119
+ r=[precision_pct] * 360,
120
+ theta=list(range(360)),
121
+ width=1,
122
  name=f'Precision: {precision_pct:.1f}%',
123
  marker_color='#5cb85c',
124
+ marker_line_color='#5cb85c',
125
+ marker_line_width=0,
126
+ opacity=0.9,
127
+ base=65,
128
  ))
129
 
130
  # Recall - third ring (orange)
131
  fig.add_trace(go.Barpolar(
132
+ r=[recall_pct] * 360,
133
+ theta=list(range(360)),
134
+ width=1,
135
  name=f'Recall: {recall_pct:.1f}%',
136
  marker_color='#f0ad4e',
137
+ marker_line_color='#f0ad4e',
138
+ marker_line_width=0,
139
+ opacity=0.9,
140
+ base=45,
141
  ))
142
 
143
  # IoU - innermost ring (red)
144
  fig.add_trace(go.Barpolar(
145
+ r=[iou_pct] * 360,
146
+ theta=list(range(360)),
147
+ width=1,
148
  name=f'IoU: {iou_pct:.1f}%',
149
  marker_color='#d9534f',
150
+ marker_line_color='#d9534f',
151
+ marker_line_width=0,
152
+ opacity=0.9,
153
+ base=25,
154
  ))
155
 
156
  fig.update_layout(
 
160
  range=[0, 100],
161
  showticklabels=True,
162
  tickfont=dict(size=10),
163
+ gridcolor='rgba(128,128,128,0.3)',
164
+ tickmode='linear',
165
+ tick0=0,
166
+ dtick=20,
167
  ),
168
  angularaxis=dict(
169
  visible=True,
 
179
  y=0.5,
180
  xanchor="left",
181
  x=1.05,
182
+ font=dict(size=11),
183
+ bgcolor='rgba(0,0,0,0)'
184
  ),
185
  paper_bgcolor='rgba(0,0,0,0)',
186
  plot_bgcolor='rgba(0,0,0,0)',
187
  height=400,
188
+ margin=dict(l=40, r=140, t=40, b=40)
189
  )
190
 
191
  return fig
 
525
  with gr.Column(scale=2):
526
  gr.Markdown("### Detection Results")
527
  output_image = gr.Image(label="Detected Forgeries", type="numpy")
 
 
528
 
529
+ gr.Markdown("---")
530
+
531
  with gr.Row():
532
  with gr.Column(scale=1):
533
  gr.Markdown("### Analysis Report")