From 49b53aee2ef443afffca1562bb5277bf09df43f4 Mon Sep 17 00:00:00 2001 From: misyaguziya Date: Sat, 27 Jan 2024 00:28:33 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B[bugfix]=20Model=20:=20tqdm?= =?UTF-8?q?=E3=82=92=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- model.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/model.py b/model.py index 8580e85d..573659a7 100644 --- a/model.py +++ b/model.py @@ -12,7 +12,6 @@ from threading import Thread, Event from requests import get as requests_get import webbrowser -from tqdm import tqdm from typing import Callable from flashtext import KeywordProcessor from models.translation.translation_translator import Translator @@ -267,16 +266,13 @@ class Model: with tempfile.TemporaryDirectory() as tmp_path: res = requests_get(url, stream=True) file_size = int(res.headers.get('content-length', 0)) - pbar = tqdm(total=file_size, unit="B", unit_scale=True) total_chunk = 0 with open(os_path.join(tmp_path, filename), 'wb') as file: for chunk in res.iter_content(chunk_size=1024*5): file.write(chunk) - pbar.update(len(chunk)) if isinstance(func, Callable): total_chunk += len(chunk) func(total_chunk/file_size) - pbar.close() with ZipFile(os_path.join(tmp_path, filename)) as zf: zf.extractall(os_path.join(current_directory, tmp_directory_name))