| 16 | import torchvision.transforms as T |
| 17 | |
| 18 | class FileProgressingbar: |
| 19 | fileobj = None |
| 20 | pbar = None |
| 21 | def __init__(self, fileobj, msg): |
| 22 | fileobj.seek(0, os.SEEK_END) |
| 23 | flen = fileobj.tell() |
| 24 | fileobj.seek(0, os.SEEK_SET) |
| 25 | self.fileobj = fileobj |
| 26 | widgets = [msg, progressbar.AnimatedMarker(), ' ', progressbar.Percentage(), ' ', progressbar.Bar(), ' ', progressbar.ETA()] |
| 27 | self.pbar = progressbar.ProgressBar(widgets=widgets, maxval=flen).start() |
| 28 | |
| 29 | def update(self): |
| 30 | self.pbar.update(self.fileobj.tell()) |
| 31 | |
| 32 | |
| 33 | def img_from_base64(imagestring): |