nothere990 commited on
Commit
0daf736
1 Parent(s): 2634fd3

update main.py

Browse files
Files changed (1) hide show
  1. main.py +10 -0
main.py CHANGED
@@ -76,6 +76,8 @@ from datetime import datetime, timedelta
76
 
77
  from starlette.responses import RedirectResponse
78
  from starlette.staticfiles import StaticFiles
 
 
79
 
80
  import g4f
81
  from g4f.client import Client
@@ -157,6 +159,14 @@ app.include_router(fluxai_router, prefix="/api/v1")
157
  app.include_router(whisper_router, prefix="/api/v1")
158
  app.include_router(instagram_router, prefix="/api/v1")
159
 
 
 
 
 
 
 
 
 
160
  @app.get("/", response_class=HTMLResponse)
161
  async def read_index():
162
  with open("static/index.html") as f:
 
76
 
77
  from starlette.responses import RedirectResponse
78
  from starlette.staticfiles import StaticFiles
79
+ from starlette.middleware.sessions import SessionMiddleware
80
+ from starlette.middleware.cors import CORSMiddleware
81
 
82
  import g4f
83
  from g4f.client import Client
 
159
  app.include_router(whisper_router, prefix="/api/v1")
160
  app.include_router(instagram_router, prefix="/api/v1")
161
 
162
+ app.add_middleware(
163
+ CORSMiddleware,
164
+ allow_origins=["*"],
165
+ allow_credentials=True,
166
+ allow_methods=["*"],
167
+ allow_headers=["*"],
168
+ )
169
+
170
  @app.get("/", response_class=HTMLResponse)
171
  async def read_index():
172
  with open("static/index.html") as f: