-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.py
35 lines (27 loc) · 1.05 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from uvicorn import run
from fastapi import FastAPI
from api import storyGen, audioGen, imageGen, videoGen
from fastapi.staticfiles import StaticFiles
from fastapi.middleware.cors import CORSMiddleware
from core.config import settings
import os
os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = settings.GOOGLE_APPLICATION_CREDENTIALS
app = FastAPI()
app.mount("/static", StaticFiles(directory="static"), name="static")
app.mount("/media", StaticFiles(directory="media"), name="media")
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
@app.get("/")
def read_root():
return {"message": "Hello, World!"}
app.include_router(storyGen.router, tags=["StoryGen"], prefix="/storyGen")
app.include_router(audioGen.router, tags=["AudioGen"], prefix="/audioGen")
app.include_router(imageGen.router, tags=["ImageGen"], prefix="/imageGen")
app.include_router(videoGen.router, tags=["VideoGen"], prefix="/videoGen")
if __name__ == "__main__":
run(app, host="0.0.0.0", port=8000)