-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.py
More file actions
27 lines (21 loc) · 832 Bytes
/
Copy pathmain.py
File metadata and controls
27 lines (21 loc) · 832 Bytes
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
from fastapi import FastAPI,Form
from fastapi.middleware.cors import CORSMiddleware
from fastapi.responses import FileResponse
from Algorthim import main
app = FastAPI()
# Add CORS middleware
app.add_middleware(
CORSMiddleware,
allow_origins=["*"], # Adjust as necessary for your application
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
@app.post("/process-video/")
async def process_video_endpoint(drive_link: str = Form(...)):
main(drive_link)
# Serve video with 'inline' disposition, so the browser can display it
return FileResponse('Output_video/output_with_full_annotations.mp4', media_type="video/mp4", filename="output_video.mp4")
# if __name__ == "__main__":
# import uvicorn
# uvicorn.run(app, host="0.0.0.0", port=8000)