File size: 494 Bytes
fca87db
 
 
 
 
 
 
47e51e3
 
 
fca87db
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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}