Spaces:
Runtime error
Runtime error
tracinginsights
commited on
Commit
•
64b17e8
1
Parent(s):
d047e59
Update main.py
Browse files
main.py
CHANGED
@@ -13,7 +13,7 @@ from pydantic import BaseModel
|
|
13 |
import functools
|
14 |
import math
|
15 |
import numpy as np
|
16 |
-
|
17 |
|
18 |
|
19 |
import available_data
|
@@ -257,13 +257,16 @@ async def session_drivers(year: int, event: str | int, session: str) -> any:
|
|
257 |
|
258 |
# get drivers available for a given year, event and session
|
259 |
f1session = fastf1.get_session(year, event, session)
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
|
|
|
|
|
|
267 |
|
268 |
|
269 |
return {"drivers": drivers}
|
|
|
13 |
import functools
|
14 |
import math
|
15 |
import numpy as np
|
16 |
+
import concurrent.futures
|
17 |
|
18 |
|
19 |
import available_data
|
|
|
257 |
|
258 |
# get drivers available for a given year, event and session
|
259 |
f1session = fastf1.get_session(year, event, session)
|
260 |
+
f1session.load(telemetry=False, weather=False, messages=False)
|
261 |
+
laps = f1session.laps
|
262 |
+
|
263 |
+
team_colors = available_data.team_colors(year)
|
264 |
+
|
265 |
+
drivers = laps.Driver.unique()
|
266 |
+
# for each driver in drivers, get the Team column from laps and get the color from team_colors dict
|
267 |
+
drivers = [{"color": team_colors[laps[laps.Driver ==
|
268 |
+
driver].Team.iloc[0]], "label": driver, "value": driver} for driver in drivers]
|
269 |
+
|
270 |
|
271 |
|
272 |
return {"drivers": drivers}
|