Spaces:
Paused
Paused
Update app_celery.py
Browse files- app_celery.py +34 -31
app_celery.py
CHANGED
@@ -150,42 +150,45 @@ def main(args):
|
|
150 |
# source_image_flag=True, pic_size=args.size)
|
151 |
|
152 |
|
153 |
-
fixed_temp_dir = "/tmp/preprocess_data"
|
154 |
-
os.makedirs(fixed_temp_dir, exist_ok=True)
|
155 |
-
preprocessed_data_path = os.path.join(fixed_temp_dir, "preprocessed_data.pkl")
|
156 |
-
|
157 |
-
if os.path.exists(preprocessed_data_path) and image_hardcoded == "yes":
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
|
167 |
-
|
168 |
|
169 |
-
else:
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
|
181 |
-
|
182 |
-
|
183 |
-
|
|
|
|
|
|
|
|
|
|
|
184 |
|
|
|
185 |
|
186 |
-
with open(preprocessed_data_path, "wb") as f:
|
187 |
-
pickle.dump(preprocessed_data, f)
|
188 |
-
print(f"Preprocessed data saved to: {preprocessed_data_path}")
|
189 |
|
190 |
print('first_coeff_path ',first_coeff_new_path)
|
191 |
print('crop_pic_path ',crop_pic_new_path)
|
|
|
150 |
# source_image_flag=True, pic_size=args.size)
|
151 |
|
152 |
|
153 |
+
# fixed_temp_dir = "/tmp/preprocess_data"
|
154 |
+
# os.makedirs(fixed_temp_dir, exist_ok=True)
|
155 |
+
# preprocessed_data_path = os.path.join(fixed_temp_dir, "preprocessed_data.pkl")
|
156 |
+
|
157 |
+
# if os.path.exists(preprocessed_data_path) and image_hardcoded == "yes":
|
158 |
+
# print("Loading preprocessed data...")
|
159 |
+
# with open(preprocessed_data_path, "rb") as f:
|
160 |
+
# preprocessed_data = pickle.load(f)
|
161 |
+
# first_coeff_new_path = preprocessed_data["first_coeff_path"]
|
162 |
+
# crop_pic_new_path = preprocessed_data["crop_pic_path"]
|
163 |
+
# crop_info_path = preprocessed_data["crop_info_path"]
|
164 |
+
# with open(crop_info_path, "rb") as f:
|
165 |
+
# crop_info = pickle.load(f)
|
166 |
|
167 |
+
# print(f"Loaded existing preprocessed data from: {preprocessed_data_path}")
|
168 |
|
169 |
+
# else:
|
170 |
+
# print("Running preprocessing...")
|
171 |
+
# first_coeff_path, crop_pic_path, crop_info = preprocess_model.generate(pic_path, first_frame_dir, args.preprocess, source_image_flag=True)
|
172 |
+
# first_coeff_new_path = os.path.join(fixed_temp_dir, os.path.basename(first_coeff_path))
|
173 |
+
# crop_pic_new_path = os.path.join(fixed_temp_dir, os.path.basename(crop_pic_path))
|
174 |
+
# crop_info_new_path = os.path.join(fixed_temp_dir, "crop_info.pkl")
|
175 |
+
# shutil.move(first_coeff_path, first_coeff_new_path)
|
176 |
+
# shutil.move(crop_pic_path, crop_pic_new_path)
|
177 |
+
|
178 |
+
# with open(crop_info_new_path, "wb") as f:
|
179 |
+
# pickle.dump(crop_info, f)
|
180 |
|
181 |
+
# preprocessed_data = {"first_coeff_path": first_coeff_new_path,
|
182 |
+
# "crop_pic_path": crop_pic_new_path,
|
183 |
+
# "crop_info_path": crop_info_new_path}
|
184 |
+
|
185 |
+
|
186 |
+
# with open(preprocessed_data_path, "wb") as f:
|
187 |
+
# pickle.dump(preprocessed_data, f)
|
188 |
+
# print(f"Preprocessed data saved to: {preprocessed_data_path}")
|
189 |
|
190 |
+
first_coeff_path, crop_pic_path, crop_info = preprocess_model.generate(pic_path, first_frame_dir, args.preprocess, source_image_flag=True)
|
191 |
|
|
|
|
|
|
|
192 |
|
193 |
print('first_coeff_path ',first_coeff_new_path)
|
194 |
print('crop_pic_path ',crop_pic_new_path)
|