File size: 1,036 Bytes
4e7dde3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a1cc9cf
4e7dde3
a1cc9cf
 
4e7dde3
 
 
 
 
 
 
 
 
 
 
 
 
2acbdb2
 
 
 
4e7dde3
a1cc9cf
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
35
36
37
38
39
from fastapi import FastAPI, Depends, HTTPException, status, File,  UploadFile
from fastapi.security import OAuth2PasswordBearer, OAuth2PasswordRequestForm
from fastapi.middleware.cors import CORSMiddleware

from typing import List
from app.routers import video
from typing import Annotated
# from transparent_background import Remover
import uvicorn,os

from datetime import timedelta
from dotenv import load_dotenv

# Load environment variables from .env file
load_dotenv()


# Read environment variables
host = os.getenv("HOST", "0.0.0.0")
port = int(os.getenv("PORT", 8000))
print(host,port)
app = FastAPI()

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

app.include_router(video.router)

@app.get("/")
async def root():
    return {"greeting": "Hello, World!", "message": "This is a service to extract the first frame of a video!"}

if __name__ == "__main__":
    uvicorn.run("app.main:app", host=host, port=port, log_level="info")