Skip to content

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

3 participants