feat: auto clean.
This commit is contained in:
@@ -82,7 +82,7 @@ def gen_distance(data, theme_type):
|
||||
save_image(dst, png_file_path)
|
||||
with open(png_file_path, "rb") as image_file:
|
||||
encoded_string = base64.b64encode(image_file.read()).decode('utf-8')
|
||||
return encoded_string
|
||||
return encoded_string, png_file_path
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
@@ -126,7 +126,7 @@ def gen_common(data, theme_type):
|
||||
save_image(dst, png_file_path)
|
||||
with open(png_file_path, "rb") as image_file:
|
||||
encoded_string = base64.b64encode(image_file.read()).decode('utf-8')
|
||||
return encoded_string
|
||||
return encoded_string, png_file_path
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
@@ -89,7 +89,7 @@ def gen_service(data):
|
||||
save_image(dst, png_file_path)
|
||||
with open(png_file_path, "rb") as image_file:
|
||||
encoded_string = base64.b64encode(image_file.read()).decode('utf-8')
|
||||
return encoded_string
|
||||
return encoded_string, png_file_path
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
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__':
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
SCALE = 2.0
|
||||
SCALE = 4.0
|
||||
ALPHA = 1.0 # [0, 1]
|
||||
|
||||
COLOR_WHITE = '#ffffff'
|
||||
|
||||
Reference in New Issue
Block a user