This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @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: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @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 %s %s.wav' % ( | |
| filename, filename[:-4]) | |
| os.system(sox_command) | |
| with open('current_file.text', 'w+') as f: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| with open(tmp_path + 'recording.wav') as inf: | |
| files = [ | |
| ('file', ('request', json.dumps(data), 'application/json; charset=UTF-8')), | |
| ('file', ('audio', inf, 'audio/L16; rate=16000; channels=1')) | |
| ] | |
| resp = requests.post(url, headers=headers, files=files) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| with open(tmp_path + 'recording.wav') as inf: | |
| files = [ | |
| ('file', ('request', json.dumps(data), 'application/json; charset=UTF-8')), | |
| ('file', ('audio', inf, 'audio/L16; rate=16000; channels=1')) | |
| ] | |
| resp = requests.post(url, headers=headers, files=files) | |
| resp_copy = requests.post('http://speech-analysis-server-ip-address/recording', files=[files[1]]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| from flask import Flask, request | |
| from flask_ask import Ask, statement, question, session | |
| import json | |
| import requests | |
| basedir = os.path.abspath(os.path.dirname(__file__)) | |
| app = Flask(__name__) | |
| ask = Ask(app, "/") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| # Generated by Django 1.9.8 on 2017-03-29 18:34 | |
| from __future__ import unicode_literals | |
| from django.db import migrations, models | |
| import uuid | |
| from django.db.models.signals import post_save | |
| from core.hooks.allocation_source import ( | |
| listen_for_allocation_threshold_met, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| # Generated by Django 1.9.8 on 2017-03-29 18:34 | |
| from __future__ import unicode_literals | |
| from django.db import migrations, models | |
| import uuid | |
| from django.db.models.signals import post_save | |
| from django.db.models.query import Q | |
| from core.hooks.allocation_source import ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # DATA PROVIDED TO US. STRUCTURE CANNOT BE MODIFIED! WELCOME TO THE REAL WORLD PRINCESS | |
| sizes = [ | |
| { | |
| "name": "item_1", | |
| "size_in_mL": "100mL", | |
| "alternate_identifier": "axc45" | |
| }, | |
| { | |
| "name": "item_2", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| echo "Hello" |