commit e44dd84f334f6433bca421122b6ec158934f035f Author: Tony Yang Date: Mon Jan 9 19:31:07 2023 +0800 init: server framework diff --git a/server.py b/server.py new file mode 100644 index 0000000..e760966 --- /dev/null +++ b/server.py @@ -0,0 +1,29 @@ +from flask import Flask, render_template, jsonify, send_file + +app = Flask(__name__) + +imagePath = "./static/photo.jpg" + +@app.route("/") +def index(): + return send_file("index.html") + +@app.route("/poll") +def poll(): + data = { + "state": "camera" + } + + return jsonify(data) + +@app.route("/photo") +def photo(): + return send_file(imagePath) + +# 放下垃圾 +# 拍好照 +# 辨識好 +# 準備好下一個 + +if __name__ == "__main__": + app.run(debug=True) \ No newline at end of file