anyaudio / anyaudio-server

:musical_note: Simple server to search youtube and give direct audio download and stream links
91 stars 19 forks source link

play local audio using flask. #166

Open DolphinRidz opened 3 years ago

DolphinRidz commented 3 years ago

I can choose the audio and predict but i want to play the audio in same page. Please reply asap.

code below:

@app.route("/", methods=["GET", "POST"]) def index(): prediction="" if request.method == "POST": print("FORM DATA RECEIVED") if "file" not in request.files: return redirect(request.url) file = request.files["file"] if file.filename == "": return redirect(request.url) if file: new_feature = extract_feature(file, mfcc=True, chroma=True, mel=True) prediction = model.predict([new_feature]) return render_template('index.html', prediction_text=prediction)