Commit
·
0d9301d
1
Parent(s):
b03c76b
Update Scripts/sdxllorapps.py
Browse files- Scripts/sdxllorapps.py +27 -0
Scripts/sdxllorapps.py
CHANGED
@@ -97,6 +97,33 @@ def depsinst(url, dst):
|
|
97 |
pbar.update(len(buffer))
|
98 |
f.close()
|
99 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
|
101 |
def ntbk():
|
102 |
|
|
|
97 |
pbar.update(len(buffer))
|
98 |
f.close()
|
99 |
|
100 |
+
|
101 |
+
|
102 |
+
def dwn(url, dst, msg):
|
103 |
+
file_size = None
|
104 |
+
req = Request(url, headers={"User-Agent": "torch.hub"})
|
105 |
+
u = urlopen(req)
|
106 |
+
meta = u.info()
|
107 |
+
if hasattr(meta, 'getheaders'):
|
108 |
+
content_length = meta.getheaders("Content-Length")
|
109 |
+
else:
|
110 |
+
content_length = meta.get_all("Content-Length")
|
111 |
+
if content_length is not None and len(content_length) > 0:
|
112 |
+
file_size = int(content_length[0])
|
113 |
+
|
114 |
+
with tqdm(total=file_size, disable=False, mininterval=0.5,
|
115 |
+
bar_format=msg+' |{bar:20}| {percentage:3.0f}%') as pbar:
|
116 |
+
with open(dst, "wb") as f:
|
117 |
+
while True:
|
118 |
+
buffer = u.read(8192)
|
119 |
+
if len(buffer) == 0:
|
120 |
+
break
|
121 |
+
f.write(buffer)
|
122 |
+
pbar.update(len(buffer))
|
123 |
+
f.close()
|
124 |
+
|
125 |
+
|
126 |
+
|
127 |
|
128 |
def ntbk():
|
129 |
|