Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from flask import Flask, request, jsonify
|
2 |
+
|
3 |
+
app = Flask(__name__)
|
4 |
+
|
5 |
+
@app.route('/process_audio', methods=['POST'])
|
6 |
+
def process_audio():
|
7 |
+
# Check if a file is part of the request
|
8 |
+
if 'audio_file' not in request.files:
|
9 |
+
return jsonify(error="Audio file is missing."), 400
|
10 |
+
|
11 |
+
audio_file = request.files['audio_file']
|
12 |
+
# You may want to save the file or process it here
|
13 |
+
|
14 |
+
# Extract string parameters
|
15 |
+
param1 = request.form.get('param1', '')
|
16 |
+
param2 = request.form.get('param2', '')
|
17 |
+
|
18 |
+
# Example processing logic
|
19 |
+
response = {
|
20 |
+
'message': 'File received',
|
21 |
+
'param1': param1,
|
22 |
+
'param2': param2
|
23 |
+
}
|
24 |
+
|
25 |
+
return jsonify(response), 200
|
26 |
+
|
27 |
+
if __name__ == '__main__':
|
28 |
+
app.run(debug=True, host='0.0.0.0', port=8000)
|