Commit ·
4778007
1
Parent(s): 4356c14
Create server.py
Browse files
server.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# server.py
|
| 2 |
+
from flask import Flask, render_template
|
| 3 |
+
import subprocess
|
| 4 |
+
|
| 5 |
+
app = Flask(__name__)
|
| 6 |
+
|
| 7 |
+
@app.route('/')
|
| 8 |
+
def index():
|
| 9 |
+
return render_template('index.html')
|
| 10 |
+
|
| 11 |
+
@app.route('/start-recording', methods=['POST'])
|
| 12 |
+
def start_recording():
|
| 13 |
+
# Execute the Python script (app.py) with Gradio when the button is pressed
|
| 14 |
+
subprocess.Popen(["python", "app.py"])
|
| 15 |
+
return "Recording started."
|
| 16 |
+
|
| 17 |
+
if __name__ == '__main__':
|
| 18 |
+
app.run(debug=True)
|