init: server framework
This commit is contained in:
commit
e44dd84f33
29
server.py
Normal file
29
server.py
Normal file
@ -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)
|
Loading…
x
Reference in New Issue
Block a user