test_docker / app.py
danieaneta
application
fca87db
raw
history blame
740 Bytes
from fastapi import FastAPI, File, UploadFile
# from depth_est_deprecated import DepthEstimation
from depth_est import DepthEstimation
import base64
app = FastAPI()
# @app.get("/depth")
# async def depth(image: str):
# depth_base64 = DepthEstimation(image).run_depth()
# return {"output": depth_base64}
# @app.get("/depth")
# async def depth(file: UploadFile):
# depth_base64 = DepthEstimation(File).run_depth()
# return {"output": depth_base64}
@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}