feat: auto clean.
This commit is contained in:
10
server.py
10
server.py
@@ -6,6 +6,7 @@ from main.distance import *
|
||||
from main.sa_pa import *
|
||||
|
||||
import json
|
||||
import os
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
@@ -15,35 +16,38 @@ CORS(app)
|
||||
def common():
|
||||
json_data = json.loads(request.args.get('data'))
|
||||
theme = request.args.get('theme')
|
||||
data = gen_common(json_data, theme)
|
||||
data, path = gen_common(json_data, theme)
|
||||
res = {
|
||||
'code': 0,
|
||||
'image': data,
|
||||
}
|
||||
response = make_response(res)
|
||||
os.remove(path)
|
||||
return response
|
||||
|
||||
@app.route('/api/pov-element/distance', methods=["GET"])
|
||||
def distance():
|
||||
json_data = json.loads(request.args.get('data'))
|
||||
theme = request.args.get('theme')
|
||||
data = gen_distance(json_data, theme)
|
||||
data, path = gen_distance(json_data, theme)
|
||||
res = {
|
||||
'code': 0,
|
||||
'image': data,
|
||||
}
|
||||
response = make_response(res)
|
||||
os.remove(path)
|
||||
return response
|
||||
|
||||
@app.route('/api/pov-element/service', methods=["GET"])
|
||||
def service():
|
||||
json_data = json.loads(request.args.get('data'))
|
||||
data = gen_service(json_data)
|
||||
data, path = gen_service(json_data)
|
||||
res = {
|
||||
'code': 0,
|
||||
'image': data,
|
||||
}
|
||||
response = make_response(res)
|
||||
os.remove(path)
|
||||
return response
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
Reference in New Issue
Block a user