[ Python ] Open WebUI 커스터마이징 - file upload(1)
try_upload def try_upload(path, mime_type, upload_name): with open(path, "rb") as f: return requests.post( f"{WEBUI}/api/v1/files/", headers=HDR_FILE, files={"file": (upload_name, f, mime_type)}, timeout=60, ) path : 업로드할 로컬 파일의 절대 경로mime_type : 서버에 전달할 콘텐츠 타입upload_name : 서버/웹UI에 표시될 파일명 with open(path, "rb") as f - 바이너리 읽기 모드로 file ..
더보기