Skip to content

Commit

Permalink
added CORS middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
aritroCoder committed Dec 11, 2023
1 parent 09aca35 commit 440ba58
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions forecaster/server.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from pydantic import BaseModel
import pandas as pd
import numpy as np
Expand Down Expand Up @@ -144,6 +145,18 @@ def validate_one_epoch(model, test_loader, loss_function):

app = FastAPI()

origins = [
"*",
]

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


@app.get("/")
async def root():
Expand Down

0 comments on commit 440ba58

Please sign in to comment.