Skip to content

Instantly share code, notes, and snippets.

@amit4111989
Created January 19, 2017 13:00
Show Gist options
  • Save amit4111989/b221316d89649f520f0aa0aaa4b816ce to your computer and use it in GitHub Desktop.
Save amit4111989/b221316d89649f520f0aa0aaa4b816ce to your computer and use it in GitHub Desktop.
@app.route('/recording', methods=['POST'])
def alexa_task():
file = request.files['file']
filename = str(file.filename)
file.save('current_data/' + file.filename)
reply = {'msg': 'Success'}
sox_command = 'sox -r 16000 -e unsigned -b 16 -c 1 current_data/%s current_data/%s.wav' % (
filename, filename[:-4])
os.system(sox_command)
with open('current_file.text', 'w+') as f:
f.write(str(filename[:-4]))
return jsonify({'reply': reply}), 201
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment