Spaces:
Runtime error
Runtime error
tracinginsights
commited on
Commit
•
f77afce
1
Parent(s):
751f2b0
Update main.py
Browse files
main.py
CHANGED
@@ -4,6 +4,7 @@ import os
|
|
4 |
import fastf1
|
5 |
import pandas as pd
|
6 |
from fastapi import FastAPI
|
|
|
7 |
from fastapi.responses import FileResponse, HTMLResponse
|
8 |
from pydantic import BaseModel
|
9 |
|
@@ -11,6 +12,20 @@ import available_data
|
|
11 |
|
12 |
app = FastAPI()
|
13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
@app.get("/", response_model=None)
|
16 |
async def root():
|
|
|
4 |
import fastf1
|
5 |
import pandas as pd
|
6 |
from fastapi import FastAPI
|
7 |
+
from fastapi.middleware.cors import CORSMiddleware
|
8 |
from fastapi.responses import FileResponse, HTMLResponse
|
9 |
from pydantic import BaseModel
|
10 |
|
|
|
12 |
|
13 |
app = FastAPI()
|
14 |
|
15 |
+
origins = [
|
16 |
+
"http://localhost",
|
17 |
+
"http://localhost:8080",
|
18 |
+
"http://localhost:3000",
|
19 |
+
]
|
20 |
+
|
21 |
+
app.add_middleware(
|
22 |
+
CORSMiddleware,
|
23 |
+
allow_origins=origins,
|
24 |
+
allow_credentials=True,
|
25 |
+
allow_methods=["*"],
|
26 |
+
allow_headers=["*"],
|
27 |
+
)
|
28 |
+
|
29 |
|
30 |
@app.get("/", response_model=None)
|
31 |
async def root():
|