Spaces:
Runtime error
Runtime error
Commit
·
eaacfe0
1
Parent(s):
fd7a815
Update main.py
Browse files
main.py
CHANGED
@@ -6,38 +6,55 @@ GITHUB_PAT = os.environ['GITHUB']
|
|
6 |
if not os.path.exists('repo_directory'):
|
7 |
Repo.clone_from(f'https://tracinginsights:{GITHUB_PAT}@github.com/TracingInsights/fastf1api.git', 'repo_directory' )
|
8 |
|
9 |
-
from repo_directory import *
|
10 |
-
|
11 |
-
import datetime
|
12 |
-
import os
|
13 |
-
import streamlit as st
|
14 |
-
import numpy as np
|
15 |
-
import math
|
16 |
-
import fastf1
|
17 |
-
import pandas as pd
|
18 |
-
from fastapi import FastAPI, Response
|
19 |
-
from fastapi.middleware.cors import CORSMiddleware
|
20 |
-
from fastapi.responses import FileResponse, HTMLResponse
|
21 |
-
from pydantic import BaseModel
|
22 |
-
|
23 |
-
import functools
|
24 |
-
import math
|
25 |
-
import numpy as np
|
26 |
-
import concurrent.futures
|
27 |
-
|
28 |
-
|
29 |
-
import available_data
|
30 |
-
|
31 |
-
app = FastAPI()
|
32 |
-
|
33 |
-
app.add_middleware(
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
)
|
40 |
-
|
41 |
-
FASTF1_CACHE_DIR = 'cache' #os.environ['FASTF1_CACHE_DIR']
|
42 |
-
|
43 |
-
fastf1.Cache.enable_cache(FASTF1_CACHE_DIR)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
if not os.path.exists('repo_directory'):
|
7 |
Repo.clone_from(f'https://tracinginsights:{GITHUB_PAT}@github.com/TracingInsights/fastf1api.git', 'repo_directory' )
|
8 |
|
9 |
+
from repo_directory.main import *
|
10 |
+
|
11 |
+
# import datetime
|
12 |
+
# import os
|
13 |
+
# import streamlit as st
|
14 |
+
# import numpy as np
|
15 |
+
# import math
|
16 |
+
# import fastf1
|
17 |
+
# import pandas as pd
|
18 |
+
# from fastapi import FastAPI, Response
|
19 |
+
# from fastapi.middleware.cors import CORSMiddleware
|
20 |
+
# from fastapi.responses import FileResponse, HTMLResponse
|
21 |
+
# from pydantic import BaseModel
|
22 |
+
|
23 |
+
# import functools
|
24 |
+
# import math
|
25 |
+
# import numpy as np
|
26 |
+
# import concurrent.futures
|
27 |
+
|
28 |
+
|
29 |
+
# import available_data
|
30 |
+
|
31 |
+
# app = FastAPI()
|
32 |
+
|
33 |
+
# app.add_middleware(
|
34 |
+
# CORSMiddleware,
|
35 |
+
# allow_origins=["*"],
|
36 |
+
# allow_credentials=True,
|
37 |
+
# allow_methods=["*"],
|
38 |
+
# allow_headers=["*"],
|
39 |
+
# )
|
40 |
+
|
41 |
+
# FASTF1_CACHE_DIR = 'cache' #os.environ['FASTF1_CACHE_DIR']
|
42 |
+
|
43 |
+
# fastf1.Cache.enable_cache(FASTF1_CACHE_DIR)
|
44 |
+
|
45 |
+
# @app.get("/", response_model=None)
|
46 |
+
# async def root():
|
47 |
+
# return HTMLResponse(
|
48 |
+
# content="""<iframe src="https://tracinginsights-f1-analysis.hf.space" frameborder="0" style="width:100%; height:100%;" scrolling="yes" allowfullscreen:"yes"></iframe>""",
|
49 |
+
# status_code=200)
|
50 |
+
|
51 |
+
|
52 |
+
# @app.get("/years", response_model=None)
|
53 |
+
# async def years_available() -> any:
|
54 |
+
# # make a list from 2018 to current year
|
55 |
+
# current_year = datetime.datetime.now().year
|
56 |
+
# years = list(range(2018, current_year+1))
|
57 |
+
# # reverse the list to get the latest year first
|
58 |
+
# years.reverse()
|
59 |
+
# years = [{"label": str(year), "value": year} for year in years]
|
60 |
+
# return {"years": years}
|