-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
36 lines (27 loc) · 972 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
30
31
32
33
34
35
36
import os
# os.system('sh setup.sh')
from flask import Flask, render_template, request, send_from_directory
# from main import main
application = Flask(__name__, static_url_path='/static')
# output_name = 'static/new.mp3'
@application.route('/', methods=['GET'])
def hello_world():
return render_template("index.html")
@application.route('/', methods=['POST'])
def predict():
output_name = 'static/new.mp3'
sound_file=request.files['soundfile']
sound_path = './static/'+sound_file.filename
sound_file.save(sound_path)
# main(sound_path, output_name)
if not os.path.exists(output_name):
output_name = sound_path
return render_template('index.html', output=output_name)
# @app.route('/js/<path:path>')
# def send_js(path):
# return send_from_directory('js', path)
# @app.route('/')
# def root():
# return app.send_static_file('index.html')
if __name__=="__main__":
app.run(debug=True)#, port=3000, host='0.0.0.0')