-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.py
64 lines (48 loc) · 1.47 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
from flask import Flask
from flask import render_template,request
from motor import Motor
from AI import AIOBJ
app = Flask(__name__)
motor=Motor()
AIOBJ.setupMotionControl(motor)
@app.route("/",methods=['GET','POST'])
def remote():
if request.method=="POST":
what=request.form['what']
if what=='power':
power=request.form['data']
print(power)
motor.power(int(power))
else:
# pass
motor.userControl(what)
return render_template("index.html")
@app.route("/todo")
def todoList():
with open('static/todo.txt', 'r') as file:
contents = file.readlines()
print(contents)
task=[]
day=[]
for i in contents:
l=i.split(':')
task.append(l[0])
day.append(l[1])
return render_template('todo.html',task=task,day=day)
@app.route("/speak",methods=['GET','POST'])
def speak():
if request.method=="POST":
prompt=request.form['data']
print("Main.py prompt=",prompt)
if (AIOBJ.main(prompt)):
return render_template('speech.html')
else:
return render_template('speech.html')
return render_template('speech.html')
@app.route('/prompt',methods=['GET','POST'])
def prompt():
if request.method=='POST':
pass
return render_template('')
if __name__=="__main__":
app.run(debug=False,host='0.0.0.0',port=8000)