Sarvamangalak commited on
Commit
74714dc
Β·
verified Β·
1 Parent(s): d91361a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -20
app.py CHANGED
@@ -600,16 +600,16 @@ def get_dashboard():
600
 
601
  report = (
602
 
603
- "TRAFFIC ANALYTICS REPORT\n\n"
604
 
605
- f"Total Vehicles : {len(df)}\n\n"
606
 
607
- f"EV Vehicles : {ev_count}\n\n"
608
 
609
- f"Non-EV Vehicles : {non_ev_count}\n\n"
610
 
611
  f"EV Percentage : "
612
- f"{ev_percentage:.2f}%\n\n"
613
 
614
  f"Discount Given : "
615
  f"β‚Ή{total_discount}"
@@ -1105,11 +1105,11 @@ def traffic_ai_agent(user_query):
1105
 
1106
  response = (
1107
 
1108
- "AI TRAFFIC ANALYSIS\n\n"
1109
 
1110
- f"EV vehicles detected: {ev}\n\n"
1111
 
1112
- f"Total vehicles: {total}\n\n"
1113
 
1114
  f"EV percentage: "
1115
  f"{ev_percentage:.2f}%"
@@ -1131,6 +1131,7 @@ def traffic_ai_agent(user_query):
1131
  "non ev" in query
1132
  or "non-ev" in query
1133
  or "non electric" in query
 
1134
  ):
1135
 
1136
  response = (
@@ -1280,9 +1281,9 @@ def traffic_ai_agent(user_query):
1280
 
1281
  response = (
1282
 
1283
- " EV TRAFFIC TREND\n\n"
1284
 
1285
- f"Total EV vehicles: {ev}\n\n"
1286
 
1287
  f"Overall EV percentage: "
1288
  f"{ev_percentage:.2f}%"
@@ -1311,9 +1312,9 @@ def traffic_ai_agent(user_query):
1311
 
1312
  " TRAFFIC ANALYSIS\n\n"
1313
 
1314
- f"Total vehicles detected: {total}\n\n"
1315
 
1316
- f"EV vehicles: {ev}\n\n"
1317
 
1318
  f"Non-EV vehicles: {non_ev}"
1319
 
@@ -1335,6 +1336,7 @@ def traffic_ai_agent(user_query):
1335
  or "carbon" in query
1336
  or "environment" in query
1337
  or "emission" in query
 
1338
  ):
1339
 
1340
  # Project-level illustrative estimate.
@@ -1675,7 +1677,7 @@ def process_image(img):
1675
  f"Status: {status}\n"
1676
 
1677
  "Result: Duplicate - "
1678
- "not added again\n\n"
1679
 
1680
  )
1681
 
@@ -1692,7 +1694,7 @@ def process_image(img):
1692
 
1693
  f"Status: {status}\n"
1694
 
1695
- "Database: Error\n\n"
1696
 
1697
  )
1698
 
@@ -1953,7 +1955,7 @@ with gr.Blocks(
1953
  # ========================================================
1954
 
1955
  gr.Markdown(
1956
- "# 🚦 Smart Traffic & EV Analytics System"
1957
  )
1958
 
1959
 
@@ -1970,7 +1972,7 @@ with gr.Blocks(
1970
  # ========================================================
1971
 
1972
  with gr.Tab(
1973
- "πŸš— Vehicle Detection"
1974
  ):
1975
 
1976
 
@@ -2005,7 +2007,7 @@ with gr.Blocks(
2005
 
2006
  btn = gr.Button(
2007
 
2008
- "πŸ” Scan Vehicle",
2009
 
2010
  variant="primary",
2011
 
@@ -2182,7 +2184,7 @@ analytics operation.
2182
 
2183
  ai_response = gr.Textbox(
2184
 
2185
- label="πŸ€– AI Analysis",
2186
 
2187
  lines=12
2188
 
@@ -2268,12 +2270,12 @@ analytics operation.
2268
  # ========================================================
2269
 
2270
  with gr.Tab(
2271
- "βš™οΈ Admin Dashboard"
2272
  ):
2273
 
2274
 
2275
  gr.Markdown(
2276
- "## βš™οΈ Vehicle Database"
2277
  )
2278
 
2279
 
 
600
 
601
  report = (
602
 
603
+ "TRAFFIC ANALYTICS REPORT\n"
604
 
605
+ f"Total Vehicles : {len(df)}\n"
606
 
607
+ f"EV Vehicles : {ev_count}\n"
608
 
609
+ f"Non-EV Vehicles : {non_ev_count}\n"
610
 
611
  f"EV Percentage : "
612
+ f"{ev_percentage:.2f}%\n"
613
 
614
  f"Discount Given : "
615
  f"β‚Ή{total_discount}"
 
1105
 
1106
  response = (
1107
 
1108
+ "AI TRAFFIC ANALYSIS\n"
1109
 
1110
+ f"EV vehicles detected: {ev}\n"
1111
 
1112
+ f"Total vehicles: {total}\n"
1113
 
1114
  f"EV percentage: "
1115
  f"{ev_percentage:.2f}%"
 
1131
  "non ev" in query
1132
  or "non-ev" in query
1133
  or "non electric" in query
1134
+ or "Nonelectric" in query
1135
  ):
1136
 
1137
  response = (
 
1281
 
1282
  response = (
1283
 
1284
+ " EV TRAFFIC TREND\n"
1285
 
1286
+ f"Total EV vehicles: {ev}\n"
1287
 
1288
  f"Overall EV percentage: "
1289
  f"{ev_percentage:.2f}%"
 
1312
 
1313
  " TRAFFIC ANALYSIS\n\n"
1314
 
1315
+ f"Total vehicles detected: {total}\n"
1316
 
1317
+ f"EV vehicles: {ev}\n"
1318
 
1319
  f"Non-EV vehicles: {non_ev}"
1320
 
 
1336
  or "carbon" in query
1337
  or "environment" in query
1338
  or "emission" in query
1339
+ or "CO2 savings" in query
1340
  ):
1341
 
1342
  # Project-level illustrative estimate.
 
1677
  f"Status: {status}\n"
1678
 
1679
  "Result: Duplicate - "
1680
+ "not added again\n"
1681
 
1682
  )
1683
 
 
1694
 
1695
  f"Status: {status}\n"
1696
 
1697
+ "Database: Error\n"
1698
 
1699
  )
1700
 
 
1955
  # ========================================================
1956
 
1957
  gr.Markdown(
1958
+ "# Smart Traffic & EV Analytics System"
1959
  )
1960
 
1961
 
 
1972
  # ========================================================
1973
 
1974
  with gr.Tab(
1975
+ "Vehicle Detection"
1976
  ):
1977
 
1978
 
 
2007
 
2008
  btn = gr.Button(
2009
 
2010
+ "Scan Vehicle",
2011
 
2012
  variant="primary",
2013
 
 
2184
 
2185
  ai_response = gr.Textbox(
2186
 
2187
+ label=" AI Analysis",
2188
 
2189
  lines=12
2190
 
 
2270
  # ========================================================
2271
 
2272
  with gr.Tab(
2273
+ " Admin Dashboard"
2274
  ):
2275
 
2276
 
2277
  gr.Markdown(
2278
+ "## Vehicle Database"
2279
  )
2280
 
2281