Update app.py
Browse files
app.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
import openai
|
| 2 |
from fastapi import FastAPI, HTTPException
|
|
|
|
| 3 |
from pydantic import BaseModel
|
| 4 |
from fastapi import FastAPI, HTTPException, Depends, Request, Response
|
| 5 |
from fastapi.security import OAuth2PasswordBearer
|
|
@@ -13,6 +14,16 @@ db = TinyDB(".token.json")
|
|
| 13 |
|
| 14 |
app = FastAPI()
|
| 15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
oauth2_scheme = OAuth2PasswordBearer(tokenUrl="token")
|
| 17 |
|
| 18 |
REF_KEY = "F0eeQ419wvoCSPH7KBmsd9OiVkF0W0DxK1XE9T3BlbkFJ0"
|
|
|
|
| 1 |
import openai
|
| 2 |
from fastapi import FastAPI, HTTPException
|
| 3 |
+
from fastapi.middleware.cors import CORSMiddleware
|
| 4 |
from pydantic import BaseModel
|
| 5 |
from fastapi import FastAPI, HTTPException, Depends, Request, Response
|
| 6 |
from fastapi.security import OAuth2PasswordBearer
|
|
|
|
| 14 |
|
| 15 |
app = FastAPI()
|
| 16 |
|
| 17 |
+
origins = ["*"]
|
| 18 |
+
|
| 19 |
+
app.add_middleware(
|
| 20 |
+
CORSMiddleware,
|
| 21 |
+
allow_origins=origins,
|
| 22 |
+
allow_credentials=True,
|
| 23 |
+
allow_methods=["*"],
|
| 24 |
+
allow_headers=["*"],
|
| 25 |
+
)
|
| 26 |
+
|
| 27 |
oauth2_scheme = OAuth2PasswordBearer(tokenUrl="token")
|
| 28 |
|
| 29 |
REF_KEY = "F0eeQ419wvoCSPH7KBmsd9OiVkF0W0DxK1XE9T3BlbkFJ0"
|