Exemplo n.º 1
0
def online_decoding_single_verbose(lan='ENGLISH'):

    lattice  = None

    arkf = request.files['ark']
    scpf = request.files['scp']
    wavef = request.files['wave']

    arkfm = FileManager(arkf)
    scpfm = FileManager(scpf)
    wavefm = FileManager(wavef)

    ext = ', '.join(FileManager.ALLOWED_EXTENSIONS)
    fileNames = ', '.join([arkf.filename, scpf.filename, wavef.filename])

    arkfm.save_tmp_file()
    scpfm.save_tmp_file()
    wavefm.save_tmp_tarfile()

    print '\ndecoding in progress\n'

    if not arkfm.isValid or not scpfm.isValid or not wavefm.isValid:
        return ( 'Invalid file extension error. \n' \
        + 'Only the following extensions are valid: [ {0} ] \n' \
        + 'File names = [ {1} ] \n' \
        + 'language = [ {2} ]' ).format(ext, fileNames, lan)

    '''Here we youd recive a file that will be sent back to the user'''
    lattice = onlineDecoding(arkfm, scpfm, wavefm, lan)

    print lattice

    return getFile(lattice)
Exemplo n.º 2
0
def saveFile():
    file = request.files['save']

    savefm = FileManager(file)
    savefm.save_tmp_file()
    #file.save('/home/dev/' + savefm.filename)
    return 'File saved!'