File size: 1,673 Bytes
bc0973c
 
3fefafb
bc0973c
3fefafb
bc0973c
 
2d12f2a
6ff62d3
eaacfe0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
from git import Repo
import os

GITHUB_PAT = os.environ['GITHUB']

if not os.path.exists('repo_directory'):  
    Repo.clone_from(f'https://tracinginsights:{GITHUB_PAT}@github.com/TracingInsights/fastf1api.git', 'repo_directory'  )

from repo_directory.main import *

# import datetime
# import os
# import streamlit as st
# import numpy as np
# import math
# import fastf1
# import pandas as pd
# from fastapi import FastAPI, Response
# from fastapi.middleware.cors import CORSMiddleware
# from fastapi.responses import FileResponse, HTMLResponse
# from pydantic import BaseModel

# import functools
# import math
# import numpy as np
# import concurrent.futures


# import available_data

# app = FastAPI()

# app.add_middleware(
#     CORSMiddleware,
#     allow_origins=["*"],
#     allow_credentials=True,
#     allow_methods=["*"],
#     allow_headers=["*"],
# )

# FASTF1_CACHE_DIR = 'cache'  #os.environ['FASTF1_CACHE_DIR']

# fastf1.Cache.enable_cache(FASTF1_CACHE_DIR)

# @app.get("/", response_model=None)
# async def root():
#     return HTMLResponse(
#         content="""<iframe src="https://tracinginsights-f1-analysis.hf.space" frameborder="0" style="width:100%; height:100%;" scrolling="yes" allowfullscreen:"yes"></iframe>""",
#         status_code=200)


# @app.get("/years", response_model=None)
# async def years_available() -> any:
#     # make a list from 2018 to current year
#     current_year = datetime.datetime.now().year
#     years = list(range(2018, current_year+1))
#     # reverse the list to get the latest year first
#     years.reverse()
#     years = [{"label": str(year), "value": year} for year in years]
#     return {"years": years}