api / main.py
tracinginsights's picture
Update main.py
eaacfe0
raw
history blame
1.67 kB
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}