Update app.py
Browse files
app.py
CHANGED
|
@@ -118,4 +118,59 @@ def generate(
|
|
| 118 |
return None, f"Output file was not created: {out_path}"
|
| 119 |
|
| 120 |
progress(1.0, desc="Done.")
|
| 121 |
-
return out_path, "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 118 |
return None, f"Output file was not created: {out_path}"
|
| 119 |
|
| 120 |
progress(1.0, desc="Done.")
|
| 121 |
+
return out_path, "Generation complete."
|
| 122 |
+
|
| 123 |
+
|
| 124 |
+
with gr.Blocks() as demo:
|
| 125 |
+
gr.Markdown("# BFS Best Face Swap Video")
|
| 126 |
+
|
| 127 |
+
with gr.Row():
|
| 128 |
+
guide_video = gr.Video(
|
| 129 |
+
label="Guide Video",
|
| 130 |
+
sources=["upload"],
|
| 131 |
+
type="filepath",
|
| 132 |
+
)
|
| 133 |
+
face_image = gr.Image(
|
| 134 |
+
label="Reference Face Image",
|
| 135 |
+
type="pil",
|
| 136 |
+
)
|
| 137 |
+
|
| 138 |
+
prompt = gr.Textbox(
|
| 139 |
+
label="Prompt",
|
| 140 |
+
lines=4,
|
| 141 |
+
placeholder="headswap FACE ... ACTION ...",
|
| 142 |
+
)
|
| 143 |
+
|
| 144 |
+
with gr.Row():
|
| 145 |
+
duration = gr.Slider(1, 10, value=5, step=0.5, label="Duration (seconds)")
|
| 146 |
+
fps = gr.Slider(8, 30, value=24, step=1, label="FPS")
|
| 147 |
+
|
| 148 |
+
with gr.Row():
|
| 149 |
+
lora_strength = gr.Slider(0.0, 2.0, value=1.0, step=0.05, label="LoRA Strength")
|
| 150 |
+
seed = gr.Number(value=42, precision=0, label="Seed")
|
| 151 |
+
|
| 152 |
+
hf_token = gr.Textbox(
|
| 153 |
+
label="Hugging Face Token (optional)",
|
| 154 |
+
type="password",
|
| 155 |
+
)
|
| 156 |
+
|
| 157 |
+
run_btn = gr.Button("Generate", variant="primary")
|
| 158 |
+
output_video = gr.Video(label="Output Video")
|
| 159 |
+
status = gr.Textbox(label="Status", interactive=False)
|
| 160 |
+
|
| 161 |
+
run_btn.click(
|
| 162 |
+
fn=generate,
|
| 163 |
+
inputs=[
|
| 164 |
+
guide_video,
|
| 165 |
+
face_image,
|
| 166 |
+
prompt,
|
| 167 |
+
duration,
|
| 168 |
+
fps,
|
| 169 |
+
lora_strength,
|
| 170 |
+
seed,
|
| 171 |
+
hf_token,
|
| 172 |
+
],
|
| 173 |
+
outputs=[output_video, status],
|
| 174 |
+
)
|
| 175 |
+
|
| 176 |
+
demo.launch()
|