Created
March 31, 2020 15:41
-
-
Save tc87/2dd80d668f36e102647ff04305862384 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Draw UI elements. | |
weights_warning = st.warning("Downloading %s..." % file_path) | |
progress_bar = st.progress(0) | |
with open(file_path, "wb") as output_file: | |
with urllib.request.urlopen(...) as response: | |
... | |
while True: | |
... # Save downloaded bytes to file here. | |
# Update UI elements. | |
weights_warning.warning( | |
"Downloading %s... (%6.2f/%6.2f MB)" % | |
(file_path, downloaded_size)) | |
progress_bar.progress(downloaded_ratio) | |
... | |
# Clear UI elements when done. | |
weights_warning.empty() | |
progress_bar.empty() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment