Muhammad Taqi Raza
commited on
Commit
·
fa2d162
1
Parent(s):
fdebd91
push
Browse files- gradio_app.py +14 -12
gradio_app.py
CHANGED
@@ -77,6 +77,16 @@ def run_epic_inference(video_path, caption, motion_type):
|
|
77 |
return logs, str(video_output_path)
|
78 |
else:
|
79 |
return f"Inference succeeded but no output video found in {output_dir}", None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
|
81 |
def inference(video_path, caption, motion_type):
|
82 |
logs, video_masked = run_epic_inference(video_path, caption, motion_type)
|
@@ -121,20 +131,12 @@ def inference(video_path, caption, motion_type):
|
|
121 |
print("Inference completed successfully.")
|
122 |
else:
|
123 |
print(f"Error occurred during inference: {result.stderr}")
|
124 |
-
|
125 |
# Print output directory contents
|
126 |
-
|
127 |
-
|
128 |
-
level = root.replace(out_dir, '').count(os.sep)
|
129 |
-
indent = ' ' * 4 * level
|
130 |
-
print(f"{indent}{os.path.basename(root)}/")
|
131 |
-
sub_indent = ' ' * 4 * (level + 1)
|
132 |
-
for f in files:
|
133 |
-
print(f"{sub_indent}{f}")
|
134 |
-
|
135 |
-
logs = result.stdout
|
136 |
|
137 |
-
return logs, str(f"{out_dir}/output.mp4")
|
138 |
|
139 |
# -----------------------------
|
140 |
# Step 3: Create Gradio UI
|
|
|
77 |
return logs, str(video_output_path)
|
78 |
else:
|
79 |
return f"Inference succeeded but no output video found in {output_dir}", None
|
80 |
+
def print_output_directory(out_dir):
|
81 |
+
result = ""
|
82 |
+
for root, dirs, files in os.walk(out_dir):
|
83 |
+
level = root.replace(out_dir, '').count(os.sep)
|
84 |
+
indent = ' ' * 4 * level
|
85 |
+
result += f"{indent}{os.path.basename(root)}/"
|
86 |
+
sub_indent = ' ' * 4 * (level + 1)
|
87 |
+
for f in files:
|
88 |
+
result += f"{sub_indent}{f}\n"
|
89 |
+
return result
|
90 |
|
91 |
def inference(video_path, caption, motion_type):
|
92 |
logs, video_masked = run_epic_inference(video_path, caption, motion_type)
|
|
|
131 |
print("Inference completed successfully.")
|
132 |
else:
|
133 |
print(f"Error occurred during inference: {result.stderr}")
|
134 |
+
|
135 |
# Print output directory contents
|
136 |
+
logs = result.stdout
|
137 |
+
result = print_output_directory(out_dir)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
|
139 |
+
return logs+result, str(f"{out_dir}/output.mp4")
|
140 |
|
141 |
# -----------------------------
|
142 |
# Step 3: Create Gradio UI
|