Skip to content

Instantly share code, notes, and snippets.

@amit4111989
Created January 19, 2017 13:55
Show Gist options
  • Save amit4111989/370d097573ef0722efb87f371c0638a0 to your computer and use it in GitHub Desktop.
Save amit4111989/370d097573ef0722efb87f371c0638a0 to your computer and use it in GitHub Desktop.
@app.route('/textfile', methods=['POST'])
def transcipt():
data = json.loads(request.data)
text = str(data['text'])
text = text.upper()
with open('current_file.text', 'r') as f:
filename = f.read()
with open('/tmp/random_folder/' + filename + '.lab', 'w+') as f:
f.write(text)
os.system('mv current_data/%s.wav /tmp/random_folder/' % filename)
os.system('rm current_data/*')
result = calculate_data(filename, '/tmp/random_folder')
os.system('rm /tmp/dexter/*')
ref_ratio = 111792.7 # ratio for men calculated from average F1/F2 data
ratio = (result[1] / ref_ratio)
with open('result.txt', 'w+') as f:
f.write('%f,%f,%f,%f' % (ratio, result[0]['a'][
'dur'], result[0]['i']['dur'], result[0]['u']['dur']))
print result, ratio # render_template('template.html',f1='10')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment