From aa0d34df26a5249db2a2ed81eeb37322c98e40be Mon Sep 17 00:00:00 2001 From: Taiga Takano Date: Wed, 2 Oct 2024 20:03:31 +0900 Subject: [PATCH] fix lint --- gradio_web_ui.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/gradio_web_ui.py b/gradio_web_ui.py index f811f68..7b9c633 100644 --- a/gradio_web_ui.py +++ b/gradio_web_ui.py @@ -10,20 +10,22 @@ mode_list = ["Create Fully Annotated Video", "Create Time-Lapse Video", "Do Not Create Video"] + def upload_mlmodel(filepaths): dest_dir = './ml_model' - + if not os.path.exists(dest_dir): os.makedirs(dest_dir) - + for filepath in filepaths: if os.path.isfile(filepath): shutil.copy(filepath, dest_dir) else: return f'{filepath} is not found' - + return "Upload complete. Please restart gradio_web_ui.py" + def inference_image(image, mlmodel_name: str, confidence: float): model = RTDETR(mlmodel_name) results = model.predict( @@ -62,12 +64,11 @@ def infer_video(videos, mlmodel_name: str, confidence: float, mode: float, progr if mode_list[0] == mode or mode_list[1] == mode: height = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT)) - width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH)) + width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH)) fourcc = cv2.VideoWriter_fourcc(*'mp4v') output_file = tempfile.NamedTemporaryFile(delete=False, suffix='.mp4').name out = cv2.VideoWriter(output_file, fourcc, fps, (width, height)) - try: while cap.isOpened(): ret, frame = cap.read() @@ -169,8 +170,8 @@ def infer_video(videos, mlmodel_name: str, confidence: float, mode: float, progr info="Choose between 0% and 100%" ), gr.Radio( - mode_list, - label="Video Creation Options", + mode_list, + label="Video Creation Options", info="Choose the type of video to create: fully annotated, time-lapse, or none." ), ],