Update app.py
Browse files
app.py
CHANGED
|
@@ -28,23 +28,23 @@ def make_temp_file(suffix: str) -> str:
|
|
| 28 |
|
| 29 |
|
| 30 |
def generate(
|
| 31 |
-
guide_video_path
|
| 32 |
-
face_image
|
| 33 |
-
prompt
|
| 34 |
-
duration
|
| 35 |
-
fps
|
| 36 |
-
lora_strength
|
| 37 |
-
seed
|
| 38 |
-
hf_token
|
| 39 |
-
progress
|
| 40 |
-
)
|
| 41 |
global _pipeline_state
|
| 42 |
|
| 43 |
if not guide_video_path:
|
| 44 |
return None, "Please upload a guide video."
|
| 45 |
if face_image is None:
|
| 46 |
return None, "Please upload a reference face image."
|
| 47 |
-
if not prompt or not prompt.strip():
|
| 48 |
return None, "Please enter a text prompt."
|
| 49 |
|
| 50 |
if not os.path.isfile(guide_video_path):
|
|
@@ -53,7 +53,7 @@ def generate(
|
|
| 53 |
if _pipeline_state is None:
|
| 54 |
progress(0, desc="Loading models (first run only — ~5 min)…")
|
| 55 |
_pipeline_state = load_pipeline(
|
| 56 |
-
token=hf_token.strip() or None,
|
| 57 |
progress_cb=lambda msg: progress(0, desc=msg),
|
| 58 |
)
|
| 59 |
|
|
@@ -128,7 +128,6 @@ with gr.Blocks() as demo:
|
|
| 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",
|
|
|
|
| 28 |
|
| 29 |
|
| 30 |
def generate(
|
| 31 |
+
guide_video_path,
|
| 32 |
+
face_image,
|
| 33 |
+
prompt,
|
| 34 |
+
duration,
|
| 35 |
+
fps,
|
| 36 |
+
lora_strength,
|
| 37 |
+
seed,
|
| 38 |
+
hf_token="",
|
| 39 |
+
progress=gr.Progress(track_tqdm=True),
|
| 40 |
+
):
|
| 41 |
global _pipeline_state
|
| 42 |
|
| 43 |
if not guide_video_path:
|
| 44 |
return None, "Please upload a guide video."
|
| 45 |
if face_image is None:
|
| 46 |
return None, "Please upload a reference face image."
|
| 47 |
+
if not prompt or not str(prompt).strip():
|
| 48 |
return None, "Please enter a text prompt."
|
| 49 |
|
| 50 |
if not os.path.isfile(guide_video_path):
|
|
|
|
| 53 |
if _pipeline_state is None:
|
| 54 |
progress(0, desc="Loading models (first run only — ~5 min)…")
|
| 55 |
_pipeline_state = load_pipeline(
|
| 56 |
+
token=str(hf_token).strip() or None,
|
| 57 |
progress_cb=lambda msg: progress(0, desc=msg),
|
| 58 |
)
|
| 59 |
|
|
|
|
| 128 |
guide_video = gr.Video(
|
| 129 |
label="Guide Video",
|
| 130 |
sources=["upload"],
|
|
|
|
| 131 |
)
|
| 132 |
face_image = gr.Image(
|
| 133 |
label="Reference Face Image",
|