Merge pull request #1926 from JRMeyer/progressbar-to-tqdm
Change progressbar to tqdm
This commit is contained in:
commit
90a067df49
1
setup.py
1
setup.py
|
@ -29,6 +29,7 @@ def main():
|
|||
"six",
|
||||
"sox",
|
||||
"soundfile",
|
||||
"tqdm",
|
||||
]
|
||||
|
||||
decoder_pypi_dep = ["coqui_stt_ctcdecoder == {}".format(version)]
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
from os import makedirs, path
|
||||
|
||||
from tqdm import tqdm
|
||||
import progressbar
|
||||
import requests
|
||||
|
||||
|
@ -26,17 +27,11 @@ def maybe_download(archive_name, target_dir, archive_url):
|
|||
print('No archive "%s" - downloading...' % archive_path)
|
||||
req = requests.get(archive_url, stream=True)
|
||||
total_size = int(req.headers.get("content-length", 0))
|
||||
done = 0
|
||||
with open_remote(archive_path, "wb") as f:
|
||||
bar = progressbar.ProgressBar(
|
||||
max_value=total_size if total_size > 0 else progressbar.UnknownLength,
|
||||
widgets=SIMPLE_BAR,
|
||||
)
|
||||
|
||||
for data in req.iter_content(1024 * 1024):
|
||||
done += len(data)
|
||||
f.write(data)
|
||||
bar.update(done)
|
||||
with tqdm(total=total_size) as bar:
|
||||
for data in req.iter_content(1024 * 1024):
|
||||
f.write(data)
|
||||
bar.update(len(data))
|
||||
else:
|
||||
print('Found archive "%s" - not downloading.' % archive_path)
|
||||
return archive_path
|
||||
|
|
Loading…
Reference in New Issue