Sarvamangalak commited on
Commit
1a39055
Β·
verified Β·
1 Parent(s): b58a070

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -17
app.py CHANGED
@@ -66,10 +66,10 @@ def detect_image(image, threshold):
66
 
67
  if image is None:
68
  return None, "Upload an image first.", \
69
- "### 🚘 Total Vehicles: 0", \
70
- "### ⚑ EV Vehicles: 0", \
71
- "### πŸ“Š EV Adoption Rate: 0%", \
72
- "### 🌱 COβ‚‚ Saved: 0 kg", \
73
  generate_dashboard(), ""
74
 
75
  vehicle_type = classify_vehicle()
@@ -95,10 +95,10 @@ Confidence Threshold: {threshold}
95
  COβ‚‚ Saved (This Detection): {co2_saved_this:.2f} kg
96
  """
97
 
98
- total_card = f"### 🚘 Total Vehicles: {total_vehicles}"
99
- ev_card = f"### ⚑ EV Vehicles: {ev_count}"
100
- percent_card = f"### πŸ“Š EV Adoption Rate: {ev_percent:.2f}%"
101
- co2_card = f"### 🌱 COβ‚‚ Saved: {total_co2_saved:.2f} kg"
102
 
103
  dashboard_fig = generate_dashboard()
104
 
@@ -194,7 +194,7 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
194
  # ----------------------------
195
  # DETECTION TAB
196
  # ----------------------------
197
- with gr.Tab("🚦 Detection System"):
198
 
199
  gr.Markdown("## Smart Vehicle Classification & EV COβ‚‚ Dashboard")
200
 
@@ -207,16 +207,16 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
207
  result_box = gr.Textbox(label="Detection Result", lines=5)
208
 
209
  with gr.Row():
210
- total_card = gr.Markdown("### 🚘 Total Vehicles: 0")
211
- ev_card = gr.Markdown("### ⚑ EV Vehicles: 0")
212
- percent_card = gr.Markdown("### πŸ“Š EV Adoption Rate: 0%")
213
- co2_card = gr.Markdown("### 🌱 COβ‚‚ Saved: 0 kg")
214
 
215
  dashboard_plot = gr.Plot(label="Analytics Dashboard")
216
 
217
  predicted_label_state = gr.State()
218
 
219
- detect_btn = gr.Button("πŸ” Detect Vehicle")
220
 
221
  detect_btn.click(
222
  fn=detect_image,
@@ -235,8 +235,8 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
235
 
236
  gr.Markdown("### Provide Feedback")
237
 
238
- correct_btn = gr.Button("βœ” Correct")
239
- incorrect_btn = gr.Button("✘ Incorrect")
240
  feedback_status = gr.Textbox(label="Feedback Status")
241
 
242
  correct_btn.click(
@@ -254,7 +254,7 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
254
  # ----------------------------
255
  # ADMIN DASHBOARD TAB
256
  # ----------------------------
257
- with gr.Tab("πŸ“Š Admin Dashboard"):
258
 
259
  gr.Markdown("## Model Evaluation Dashboard")
260
 
 
66
 
67
  if image is None:
68
  return None, "Upload an image first.", \
69
+ "### Total Vehicles: 0", \
70
+ "### EV Vehicles: 0", \
71
+ "### EV Adoption Rate: 0%", \
72
+ "### COβ‚‚ Saved: 0 kg", \
73
  generate_dashboard(), ""
74
 
75
  vehicle_type = classify_vehicle()
 
95
  COβ‚‚ Saved (This Detection): {co2_saved_this:.2f} kg
96
  """
97
 
98
+ total_card = f"### Total Vehicles: {total_vehicles}"
99
+ ev_card = f"### EV Vehicles: {ev_count}"
100
+ percent_card = f"### EV Adoption Rate: {ev_percent:.2f}%"
101
+ co2_card = f"### COβ‚‚ Saved: {total_co2_saved:.2f} kg"
102
 
103
  dashboard_fig = generate_dashboard()
104
 
 
194
  # ----------------------------
195
  # DETECTION TAB
196
  # ----------------------------
197
+ with gr.Tab("Detection System"):
198
 
199
  gr.Markdown("## Smart Vehicle Classification & EV COβ‚‚ Dashboard")
200
 
 
207
  result_box = gr.Textbox(label="Detection Result", lines=5)
208
 
209
  with gr.Row():
210
+ total_card = gr.Markdown("### Total Vehicles: 0")
211
+ ev_card = gr.Markdown("### EV Vehicles: 0")
212
+ percent_card = gr.Markdown("### EV Adoption Rate: 0%")
213
+ co2_card = gr.Markdown("### COβ‚‚ Saved: 0 kg")
214
 
215
  dashboard_plot = gr.Plot(label="Analytics Dashboard")
216
 
217
  predicted_label_state = gr.State()
218
 
219
+ detect_btn = gr.Button("Detect Vehicle")
220
 
221
  detect_btn.click(
222
  fn=detect_image,
 
235
 
236
  gr.Markdown("### Provide Feedback")
237
 
238
+ correct_btn = gr.Button("Correct")
239
+ incorrect_btn = gr.Button("Incorrect")
240
  feedback_status = gr.Textbox(label="Feedback Status")
241
 
242
  correct_btn.click(
 
254
  # ----------------------------
255
  # ADMIN DASHBOARD TAB
256
  # ----------------------------
257
+ with gr.Tab("Admin Dashboard"):
258
 
259
  gr.Markdown("## Model Evaluation Dashboard")
260