Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audio integration to front end #360

Merged
merged 6 commits into from
Apr 5, 2018

Conversation

nickyfantasy
Copy link
Contributor

  • Add flask end point
  • Read and decode audio data

* Add flask end point
* Read and decode audio data
res = re.search(r".*/([0-9]+$)", tag)
sample_index = 0
origin_tag = tag
if res:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if the regex search failed? Should we add an 'else' to deal with it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in that case we just use default sample_index = 0

def get_individual_audio(storage, mode, tag, step_index, max_size=80):

with storage.mode(mode) as reader:
res = re.search(r".*/([0-9]+$)", tag)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can abstract this " removing '/x' " logic into a method

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure


data = np.array(record.data(), dtype='uint8')

tempfile = NamedTemporaryFile(mode='w+b', suffix='.wav')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to know this method from tempfile 😄

Copy link
Collaborator

@jetfuel jetfuel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@app.route('/data/plugin/audio/individualAudio')
def individual_audio():
mode = request.args.get('run')
print mode
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove test print

@nickyfantasy nickyfantasy merged commit cfa6b02 into PaddlePaddle:develop Apr 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants