def do_android_upload(): upload = Upload('upload', ('.png','.jpg','.jpeg'), 3 * 1024 * 1024) if not upload.has_uploaded(): return '-1' if not upload.check_upload_size(): return '-1' if not upload.check_extension(): return '-1' return str(parse_upload(upload))
def do_normal_upload(): upload = Upload('upload', ('.png','.jpg','.jpeg'), 3 * 1024 * 1024) if not upload.has_uploaded(): return View('no_upload').render() if not upload.check_upload_size(): return View('upload_size').render() if not upload.check_extension(): return View('upload_extension').render() id = parse_upload(upload) if id == -1: return View('recognize_failed', { 'img' : str(upload) } ).render() return View('recognize', { 'id' : id, 'name' : nn.get_name_by_id(id), 'img' : str(upload) } ).render()