def index(): if request.method == 'POST': file = request.files['file'] if file and allowed_file(file.filename): filename = secure_filename(file.filename) file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename)) filename, pts = skinscan.detect_deffects(filename) return send_from_directory(app.config['UPLOAD_FOLDER'], filename) return render_template('index.html')
def api_v1_upload_pic(): if not request.json or not 'img' in request.json: abort(400) img_base64 = request.json['img'] img_id = generate_id() f = open(os.path.join(app.config['UPLOAD_FOLDER'], img_id + '.jpg'), "wb") f.write(base64.decodestring(img_base64)) f.close() filename, pts = skinscan.detect_deffects(img_id + '.jpg') image = {'p_name': filename, 's_name': img_id + '.jpg', 'pts': pts} images_db.append(image) return jsonify({'p_name': image['p_name'], 's_name': image['s_name']}), 201
def api_v1_upload_pic(): if not request.json or not 'img' in request.json: abort(400) img_base64 = request.json['img'] img_id = generate_id() f = open(os.path.join(app.config['UPLOAD_FOLDER'], img_id + '.jpg'), "wb") f.write(base64.decodestring(img_base64)) f.close() filename, pts = skinscan.detect_deffects(img_id + '.jpg') image = { 'p_name' : filename, 's_name' : img_id + '.jpg', 'pts' : pts } images_db.append(image) return jsonify({'p_name': image['p_name'], 's_name': image['s_name']}), 201