Commit
•
0f3499b
1
Parent(s):
7de808f
Update api.py
Browse files
api.py
CHANGED
@@ -8,29 +8,41 @@ import io
|
|
8 |
import os
|
9 |
from moviepyTest import test
|
10 |
|
11 |
-
app = FastAPI()
|
12 |
|
13 |
-
@app.get("/inference")
|
14 |
-
def inference():
|
15 |
-
|
16 |
|
17 |
-
@app.get("/infer_t5")
|
18 |
-
def t5(input):
|
19 |
|
20 |
-
|
21 |
|
22 |
-
@app.get("/moviepyTest")
|
23 |
-
def t5():
|
24 |
-
|
25 |
|
26 |
-
|
27 |
|
28 |
|
29 |
|
30 |
-
@app.post("/getCoordinates")
|
31 |
-
async def getCoordinates(image: UploadFile = File(...)):
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
import os
|
9 |
from moviepyTest import test
|
10 |
|
11 |
+
# app = FastAPI()
|
12 |
|
13 |
+
# @app.get("/inference")
|
14 |
+
# def inference():
|
15 |
+
# return "<p>Hello, World!</p>"
|
16 |
|
17 |
+
# @app.get("/infer_t5")
|
18 |
+
# def t5(input):
|
19 |
|
20 |
+
# return {"output": input}
|
21 |
|
22 |
+
# @app.get("/moviepyTest")
|
23 |
+
# def t5():
|
24 |
+
# result = test()
|
25 |
|
26 |
+
# return {"output": result}
|
27 |
|
28 |
|
29 |
|
30 |
+
# @app.post("/getCoordinates")
|
31 |
+
# async def getCoordinates(image: UploadFile = File(...)):
|
32 |
+
# img = await image.read()
|
33 |
+
# image = Image.open(io.BytesIO(img)).convert("L").convert("RGB")
|
34 |
+
# path_to_image = "save.jpg"
|
35 |
+
# image.save(path_to_image)
|
36 |
+
# return "获取图片保存成功"
|
37 |
+
|
38 |
+
|
39 |
+
|
40 |
+
|
41 |
+
from flask import Flask, request, jsonify, send_file
|
42 |
+
from io import BytesIO
|
43 |
+
|
44 |
+
app = Flask(__name__)
|
45 |
+
|
46 |
+
@app.route('/test', methods=['GET'])
|
47 |
+
def test():
|
48 |
+
return "123test"
|