change_loading_options
Browse files
app.py
CHANGED
@@ -43,11 +43,22 @@ def load_large_files(relative_path):
|
|
43 |
# Temporary download in Space
|
44 |
file_path = "/tmp/" + relative_path.split('/')[-1]
|
45 |
|
46 |
-
response = requests.get(url)
|
47 |
-
|
48 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
return file_path
|
50 |
-
|
51 |
def motion_temporal_filter(motion, sigma=1):
|
52 |
motion = motion.reshape(motion.shape[0], -1)
|
53 |
for i in range(motion.shape[1]):
|
@@ -104,7 +115,6 @@ else:
|
|
104 |
load_file_list = {}
|
105 |
for key in src_file_list.keys():
|
106 |
load_file_list[key] = load_large_files(src_file_list[key])
|
107 |
-
print(load_file_list)
|
108 |
|
109 |
model_lmm = create_lmm()
|
110 |
model_imagebind = imagebind_huge(pretrained=True, ckpt_path=load_file_list["imagebind"])
|
|
|
43 |
# Temporary download in Space
|
44 |
file_path = "/tmp/" + relative_path.split('/')[-1]
|
45 |
|
46 |
+
response = requests.get(url, stream=True)
|
47 |
+
response.raise_for_status()
|
48 |
+
total_size = int(response.headers.get("content-length", 0))
|
49 |
+
with open(file_path, "wb") as file, tqdm(
|
50 |
+
desc="Downloading",
|
51 |
+
total=total_size,
|
52 |
+
unit="B",
|
53 |
+
unit_scale=True,
|
54 |
+
unit_divisor=1024,
|
55 |
+
) as bar:
|
56 |
+
for chunk in response.iter_content(chunk_size=8192):
|
57 |
+
file.write(chunk)
|
58 |
+
bar.update(len(chunk))
|
59 |
+
print(f"File downloaded successfully and saved as: {file_path}")
|
60 |
return file_path
|
61 |
+
|
62 |
def motion_temporal_filter(motion, sigma=1):
|
63 |
motion = motion.reshape(motion.shape[0], -1)
|
64 |
for i in range(motion.shape[1]):
|
|
|
115 |
load_file_list = {}
|
116 |
for key in src_file_list.keys():
|
117 |
load_file_list[key] = load_large_files(src_file_list[key])
|
|
|
118 |
|
119 |
model_lmm = create_lmm()
|
120 |
model_imagebind = imagebind_huge(pretrained=True, ckpt_path=load_file_list["imagebind"])
|