Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -36,6 +36,7 @@ FVSM_PATH = "./ckpt/FVSM/FloVD_FVSM_Controlnet.pt"
|
|
36 |
OMSM_PATH = "./ckpt/OMSM/"
|
37 |
DEPTH_CKPT_PATH = "./ckpt/others/depth_anything_v2_metric_hypersim_vitb.pth"
|
38 |
OUTPUT_PATH = "./results/"
|
|
|
39 |
POSE_TYPE = "re10k"
|
40 |
CONTROLNET_GUIDANCE_END = 0.4
|
41 |
SPEED = 1.0
|
@@ -43,16 +44,29 @@ NUM_FRAMES = 81
|
|
43 |
FPS = 16
|
44 |
INFER_STEPS = 50
|
45 |
|
46 |
-
os.makedirs(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
|
48 |
def run_flovd(prompt, image, cam_pose_name):
|
49 |
try:
|
50 |
-
|
|
|
|
|
|
|
|
|
|
|
51 |
image_path = "./temp_input.png"
|
52 |
image.save(image_path)
|
53 |
print(f"πΈ Image saved at {image_path}")
|
54 |
|
55 |
-
# Run video generation
|
56 |
generate_video(
|
57 |
prompt=prompt,
|
58 |
fvsm_path=FVSM_PATH,
|
@@ -71,19 +85,22 @@ def run_flovd(prompt, image, cam_pose_name):
|
|
71 |
num_inference_steps=INFER_STEPS,
|
72 |
)
|
73 |
|
74 |
-
|
|
|
|
|
75 |
prompt_short = prompt[:30].strip().replace(" ", "_").replace(".", "").replace(",", "")
|
76 |
video_filename = f"{prompt_short}_{cam_pose_name}.mp4"
|
77 |
-
video_path = os.path.join(
|
78 |
|
79 |
-
print(f"π Looking for generated video at: {video_path}")
|
80 |
if os.path.exists(video_path):
|
81 |
-
print("β
Video
|
82 |
return video_path
|
83 |
else:
|
84 |
print("β File missing:", video_path)
|
85 |
-
|
86 |
-
|
|
|
87 |
except Exception as e:
|
88 |
print(f"π₯ Exception occurred: {str(e)}")
|
89 |
return f"An error occurred during generation: {str(e)}"
|
|
|
36 |
OMSM_PATH = "./ckpt/OMSM/"
|
37 |
DEPTH_CKPT_PATH = "./ckpt/others/depth_anything_v2_metric_hypersim_vitb.pth"
|
38 |
OUTPUT_PATH = "./results/"
|
39 |
+
GEN_VID_DIR = os.path.join(OUTPUT_PATH, "generated_videos")
|
40 |
POSE_TYPE = "re10k"
|
41 |
CONTROLNET_GUIDANCE_END = 0.4
|
42 |
SPEED = 1.0
|
|
|
44 |
FPS = 16
|
45 |
INFER_STEPS = 50
|
46 |
|
47 |
+
os.makedirs(GEN_VID_DIR, exist_ok=True)
|
48 |
+
|
49 |
+
def list_generated_videos():
|
50 |
+
try:
|
51 |
+
files = os.listdir(GEN_VID_DIR)
|
52 |
+
print(f"\nπ Contents of {GEN_VID_DIR}:")
|
53 |
+
for f in files:
|
54 |
+
print(f" - {f}")
|
55 |
+
except Exception as e:
|
56 |
+
print(f"[β οΈ] Could not list contents: {str(e)}")
|
57 |
|
58 |
def run_flovd(prompt, image, cam_pose_name):
|
59 |
try:
|
60 |
+
print("\n----------------------------")
|
61 |
+
print("π Starting video generation")
|
62 |
+
print("----------------------------")
|
63 |
+
|
64 |
+
list_generated_videos()
|
65 |
+
|
66 |
image_path = "./temp_input.png"
|
67 |
image.save(image_path)
|
68 |
print(f"πΈ Image saved at {image_path}")
|
69 |
|
|
|
70 |
generate_video(
|
71 |
prompt=prompt,
|
72 |
fvsm_path=FVSM_PATH,
|
|
|
85 |
num_inference_steps=INFER_STEPS,
|
86 |
)
|
87 |
|
88 |
+
print("\nβ
Generation finished.")
|
89 |
+
list_generated_videos()
|
90 |
+
|
91 |
prompt_short = prompt[:30].strip().replace(" ", "_").replace(".", "").replace(",", "")
|
92 |
video_filename = f"{prompt_short}_{cam_pose_name}.mp4"
|
93 |
+
video_path = os.path.join(GEN_VID_DIR, video_filename)
|
94 |
|
95 |
+
print(f"\nπ Looking for generated video at: {video_path}")
|
96 |
if os.path.exists(video_path):
|
97 |
+
print("β
Video file found.")
|
98 |
return video_path
|
99 |
else:
|
100 |
print("β File missing:", video_path)
|
101 |
+
list_generated_videos()
|
102 |
+
return f"[ERROR] File not found at: {video_path}"
|
103 |
+
|
104 |
except Exception as e:
|
105 |
print(f"π₯ Exception occurred: {str(e)}")
|
106 |
return f"An error occurred during generation: {str(e)}"
|