def validate_torch_files(files):
 if (str(files['weights_file'].filename) is ''):
  raise werkzeug.exceptions.BadRequest('Missing weights file')
 elif (files['weights_file'].filename.rsplit('.', 1)[1] != 't7'):
  raise werkzeug.exceptions.BadRequest('Weights must be a .t7 file')
 if (str(files['model_def_file'].filename) is ''):
  raise werkzeug.exceptions.BadRequest('Missing model definition file')
 elif (files['model_def_file'].filename.rsplit('.', 1)[1] != 'lua'):
  raise werkzeug.exceptions.BadRequest('Model definition must be .lua file')
 weights_path = get_tempfile(flask.request.files['weights_file'], '.t7')
 model_def_path = get_tempfile(flask.request.files['model_def_file'], '.lua')
 return (weights_path, model_def_path)

def validate_torch_files ( files ) : if ( str ( files [ 'weights_file' ] . filename ) is '' ) : raise werkzeug . exceptions . BadRequest ( 'Missing weights file' ) elif ( files [ 'weights_file' ] . filename . rsplit ( '.' , 1 ) [ 1 ] != 't7' ) : raise werkzeug . exceptions . BadRequest ( 'Weights must be a .t7 file' ) if ( str ( files [ 'model_def_file' ] . filename ) is '' ) : raise werkzeug . exceptions . BadRequest ( 'Missing model definition file' ) elif ( files [ 'model_def_file' ] . filename . rsplit ( '.' , 1 ) [ 1 ] != 'lua' ) : raise werkzeug . exceptions . BadRequest ( 'Model definition must be .lua file' ) weights_path = get_tempfile ( flask . request . files [ 'weights_file' ] , '.t7' ) model_def_path = get_tempfile ( flask . request . files [ 'model_def_file' ] , '.lua' ) return ( weights_path , model_def_path )
upload a torch model .