File size: 695 Bytes
07b6f54
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from flask import Flask, request, jsonify
import os
from waitress import serve
from model.predict import *

app = Flask(__name__)

@app.route('/api/create-texture', methods=['POST', 'GET', 'DELETE'])
def create_texture():   
    print(request.files)
    front_image = request.files["front"].read()
    back_image = request.files["back"].read()
    primary_color = request.form["color"]

    front_output = predict_h5(front_image)
    back_output = predict_h5(back_image)

    return jsonify({"front": front_output, "back" : back_output})


if __name__ == '__main__':
    port = int(os.environ.get('PORT', 5000))
    app.run(debug=True, host="0.0.0.0")
    # serve(app, host="0.0.0.0", port=port)