Spaces:
Sleeping
Sleeping
Delete app.py
Browse files
app.py
DELETED
@@ -1,42 +0,0 @@
|
|
1 |
-
from flask import Flask, request, jsonify, render_template
|
2 |
-
import os
|
3 |
-
from audio import predict_all
|
4 |
-
from flask_cors import CORS
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
app = Flask(__name__)
|
9 |
-
CORS(app)
|
10 |
-
@app.route('/')
|
11 |
-
def index():
|
12 |
-
return render_template('index.html')
|
13 |
-
|
14 |
-
@app.route('/upload-audio', methods=['POST'])
|
15 |
-
def upload_audio():
|
16 |
-
if 'audio' not in request.files:
|
17 |
-
return "No audio part", 400
|
18 |
-
|
19 |
-
file = request.files['audio']
|
20 |
-
if file.filename == '':
|
21 |
-
return "No selected file", 400
|
22 |
-
|
23 |
-
if file:
|
24 |
-
# You can add file saving logic here
|
25 |
-
filename = f'uploads/{file.filename}'
|
26 |
-
file.save(filename)
|
27 |
-
|
28 |
-
# Convert the NumPy array to a list
|
29 |
-
# Mock processing and response
|
30 |
-
accuracy, fluency = predict_all(filename)
|
31 |
-
# Replace this with your actual processing logic
|
32 |
-
response = {
|
33 |
-
"Accuracy": [accuracy[0], accuracy[1]],
|
34 |
-
"Fluency": [fluency[0], fluency[1]]
|
35 |
-
}
|
36 |
-
return jsonify(response), 200
|
37 |
-
|
38 |
-
return "Error processing request", 400
|
39 |
-
|
40 |
-
if __name__ == '__main__':
|
41 |
-
os.makedirs('uploads', exist_ok=True) # Create a directory for uploads
|
42 |
-
app.run(debug=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|