depthanything2 / app.py
danieaneta
infra
9266e32
raw
history blame contribute delete
492 Bytes
from fastapi import FastAPI, File, UploadFile
# from depth_est_deprecated import DepthEstimation
from depth_est import DepthEstimation
import base64
app = FastAPI()
@app.get("/")
def home():
return {"message":"Hello World"}
@app.post("/depth")
async def depth(file: UploadFile):
file_data = await file.read()
encoded_file_data = base64.b64encode(file_data).decode('utf-8')
depth_base64 = DepthEstimation(encoded_file_data).run_depth()
return {"file_data": depth_base64}