Advertisement
Guest User

Untitled

a guest
Jan 19th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. @app.route('/recording', methods=['POST'])
  2. def alexa_task():
  3. file = request.files['file']
  4. filename = str(file.filename)
  5. file.save('current_data/' + file.filename)
  6. reply = {'msg': 'Success'}
  7. sox_command = 'sox -r 16000 -e unsigned -b 16 -c 1 current_data/%s current_data/%s.wav' % (
  8. filename, filename[:-4])
  9. os.system(sox_command)
  10. with open('current_file.text', 'w+') as f:
  11. f.write(str(filename[:-4]))
  12. return jsonify({'reply': reply}), 201
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement