Adilbai commited on
Commit
4241407
·
verified ·
1 Parent(s): f8b41ac

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -22
app.py CHANGED
@@ -105,16 +105,13 @@ class EuroSATClassifier:
105
  return None, None, error_msg
106
 
107
  def create_confidence_plot(self, results):
108
- """Create a confidence plot using Plotly"""
109
  classes = list(results.keys())
110
  confidences = [results[cls] * 100 for cls in classes]
111
-
112
- colors = [
113
- '#2E8B57' if i == 0 else f'rgba(70, 130, 180, {max(0.2, 0.8 - (i / len(classes)))})'
114
- for i in range(len(classes))
115
- ]
116
-
117
-
118
  fig = go.Figure(data=[
119
  go.Bar(
120
  x=confidences,
@@ -126,35 +123,31 @@ class EuroSATClassifier:
126
  textfont=dict(color='white', size=12),
127
  )
128
  ])
129
-
130
  fig.update_layout(
131
- title={
132
- 'text': "🎯 Classification Confidence Scores",
133
- 'x': 0.5,
134
- 'xanchor': 'center',
135
- 'font': {'size': 16, 'color': '#2C3E50'}
136
- },
137
  xaxis_title="Confidence (%)",
138
  yaxis_title="Land Cover Classes",
139
  height=500,
140
- margin=dict(l=10, r=10, t=50, b=10),
141
- plot_bgcolor='rgba(248, 249, 250, 0.8)',
142
  paper_bgcolor='white',
143
- font=dict(family="Arial, sans-serif", size=12, color="#2C3E50"),
144
  xaxis=dict(
145
- gridcolor='rgba(128, 128, 128, 0.2)',
146
  showgrid=True,
147
  range=[0, 100]
148
  ),
149
  yaxis=dict(
150
- gridcolor='rgba(128, 128, 128, 0.2)',
151
  showgrid=True,
152
- autorange="reversed" # Show highest confidence at top
153
  )
154
  )
155
-
156
  return fig
157
 
 
158
  # Initialize the classifier
159
  classifier = EuroSATClassifier()
160
 
 
105
  return None, None, error_msg
106
 
107
  def create_confidence_plot(self, results):
108
+ """Create a clean confidence plot using Plotly"""
109
  classes = list(results.keys())
110
  confidences = [results[cls] * 100 for cls in classes]
111
+
112
+ # Use consistent solid colors (green for top, blue for others)
113
+ colors = ['#2E8B57' if i == 0 else '#4682B4' for i in range(len(classes))]
114
+
 
 
 
115
  fig = go.Figure(data=[
116
  go.Bar(
117
  x=confidences,
 
123
  textfont=dict(color='white', size=12),
124
  )
125
  ])
126
+
127
  fig.update_layout(
128
+ title="🎯 Classification Confidence Scores",
 
 
 
 
 
129
  xaxis_title="Confidence (%)",
130
  yaxis_title="Land Cover Classes",
131
  height=500,
132
+ margin=dict(l=10, r=10, t=40, b=10),
133
+ plot_bgcolor='white',
134
  paper_bgcolor='white',
135
+ font=dict(family="Arial", size=12, color="#333"),
136
  xaxis=dict(
137
+ gridcolor='rgba(0,0,0,0.05)',
138
  showgrid=True,
139
  range=[0, 100]
140
  ),
141
  yaxis=dict(
142
+ gridcolor='rgba(0,0,0,0.05)',
143
  showgrid=True,
144
+ autorange="reversed"
145
  )
146
  )
147
+
148
  return fig
149
 
150
+
151
  # Initialize the classifier
152
  classifier = EuroSATClassifier()
153