forked from VibhinnS/Doraemon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
30 lines (24 loc) · 893 Bytes
/
app.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
from flask import Flask, render_template, request
import subprocess
app = Flask(__name__)
@app.route('/')
def index():
return render_template('index.html')
@app.route('/main', methods=['GET','POST'])
def main():
if request.method == 'POST':
result = subprocess.run(['python', 'main.py'], capture_output=True, text=True)
print(result.stdout)
return render_template('result.html', output=result.stdout)
else:
return render_template('index.html')
@app.route('/voice', methods=['GET','POST'])
def voice():
if request.method == 'POST':
result = subprocess.run(['python', 'voice_controlled_drone.py'], capture_output=True, text=True)
print(result.stdout)
return render_template('result.html', output=result.stdout)
else:
return render_template('index.html')
if __name__ == '__main__':
app.run(debug=True)