tracinginsights commited on
Commit
42bd145
·
1 Parent(s): 773a7e1

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +6 -3
main.py CHANGED
@@ -11,6 +11,8 @@ from fastapi.responses import FileResponse, HTMLResponse
11
  from pydantic import BaseModel
12
 
13
  import functools
 
 
14
 
15
 
16
 
@@ -26,8 +28,9 @@ app.add_middleware(
26
  allow_headers=["*"],
27
  )
28
 
29
- import math
30
- import numpy as np
 
31
  def smooth_derivative(t_in, v_in):
32
 
33
  #
@@ -249,7 +252,7 @@ def sessions_available(year: int, event: str | int) -> any:
249
  @functools.cache
250
  @app.get("/{year}/{event}/{session}", response_model=None)
251
  def session_drivers(year: int, event: str | int, session: str) -> any:
252
- # fastf1.Cache.enable_cache('cache')
253
  # get drivers available for a given year, event and session
254
  f1session = fastf1.get_session(year, event, session)
255
  api_path = f1session.api_path
 
11
  from pydantic import BaseModel
12
 
13
  import functools
14
+ import math
15
+ import numpy as np
16
 
17
 
18
 
 
28
  allow_headers=["*"],
29
  )
30
 
31
+ FASTF1_CACHE_DIR = os.environ['FASTF1_CACHE_DIR']
32
+
33
+
34
  def smooth_derivative(t_in, v_in):
35
 
36
  #
 
252
  @functools.cache
253
  @app.get("/{year}/{event}/{session}", response_model=None)
254
  def session_drivers(year: int, event: str | int, session: str) -> any:
255
+ fastf1.Cache.enable_cache(FASTF1_CACHE_DIR)
256
  # get drivers available for a given year, event and session
257
  f1session = fastf1.get_session(year, event, session)
258
  api_path = f1session.api_path