File size: 799 Bytes
d38fe54
 
 
 
 
 
 
 
9f7f597
d38fe54
26fc5e2
d38fe54
26fc5e2
 
 
d38fe54
26fc5e2
 
d38fe54
26fc5e2
d38fe54
26fc5e2
 
 
9f7f597
26fc5e2
9f7f597
 
d38fe54
26fc5e2
 
 
 
 
 
 
0f3499b
 
 
 
 
 
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
40
41
42
43
from fastapi import FastAPI, File, UploadFile
from fastapi.staticfiles import StaticFiles
from fastapi.responses import FileResponse
from PIL import Image
import numpy as np
import urllib.request
import io
import os
from moviepyTest import test

app = FastAPI()

@app.get("/inference")
def inference():
    return "<p>Hello, World!</p>"
    
@app.get("/infer_t5")
def t5(input):
    
    return {"output": input}

@app.get("/moviepyTest")
def t5():
    result = test()
    
    return {"output": result}


    
@app.post("/getCoordinates")
async def getCoordinates(image: UploadFile = File(...)):
    img = await image.read()
    image = Image.open(io.BytesIO(img)).convert("L").convert("RGB")
    path_to_image = "save.jpg"
    image.save(path_to_image)
    return "获取图片保存成功"