fffiloni commited on
Commit
42ea409
·
verified ·
1 Parent(s): d7750da

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -7
app.py CHANGED
@@ -274,8 +274,10 @@ def _collect_character_refs(reference_files, reference_zip) -> list[CharacterRef
274
 
275
 
276
  def _text_args(text_prompt: str) -> list[str]:
277
- words = [part.strip() for part in (text_prompt or "").split() if part.strip()]
278
- return words or ["human", "character"]
 
 
279
 
280
 
281
  def _run_command(command: list[str], progress=None) -> str:
@@ -742,7 +744,11 @@ def build_ui():
742
  simple_ref = gr.Image(type="filepath", label="Reference image")
743
  simple_driving = gr.Video(label="Driving / source video")
744
  simple_prompt = gr.Textbox(label="Prompt for SCAIL-2", lines=3)
745
- simple_sam3_text = gr.Textbox(value="human character", label="SAM3 text prompt")
 
 
 
 
746
  with gr.Accordion("Animation options", open=True):
747
  simple_max_persons = gr.Number(value=2, precision=0, label="Max tracked subjects")
748
  simple_crop = gr.Dropdown(
@@ -789,6 +795,12 @@ def build_ui():
789
  )
790
  with gr.Accordion("Reference naming", open=True):
791
  gr.Markdown(
 
 
 
 
 
 
792
  "Upload reference images with names like:\n\n"
793
  "```text\n"
794
  "character_0__front.png\n"
@@ -805,8 +817,9 @@ def build_ui():
805
  " character_1/\n"
806
  " front.png\n"
807
  "```\n\n"
808
- "Character colors are assigned by slot order: `character_0`, then `character_1`, etc. "
809
- "The driving video is tracked left-to-right with the same color order."
 
810
  )
811
  with gr.Row():
812
  adv_refs = gr.Files(
@@ -822,7 +835,11 @@ def build_ui():
822
  adv_driving = gr.Video(label="Driving video")
823
  adv_prompt = gr.Textbox(label="Prompt for SCAIL-2", lines=3)
824
  with gr.Row():
825
- adv_sam3_text = gr.Textbox(value="human character", label="SAM3 text prompt")
 
 
 
 
826
  adv_max_subjects = gr.Number(value=2, precision=0, label="Max tracked subjects")
827
  adv_run = gr.Button("Generate advanced character pack", variant="primary")
828
  adv_gallery = gr.Gallery(
@@ -896,4 +913,4 @@ def build_ui():
896
 
897
 
898
  if __name__ == "__main__":
899
- build_ui().queue(max_size=4).launch(show_error=True)
 
274
 
275
 
276
  def _text_args(text_prompt: str) -> list[str]:
277
+ if not text_prompt or not text_prompt.strip():
278
+ return ["human character"]
279
+ parts = [part.strip() for part in re.split(r"[\n,]+", text_prompt) if part.strip()]
280
+ return parts or ["human character"]
281
 
282
 
283
  def _run_command(command: list[str], progress=None) -> str:
 
744
  simple_ref = gr.Image(type="filepath", label="Reference image")
745
  simple_driving = gr.Video(label="Driving / source video")
746
  simple_prompt = gr.Textbox(label="Prompt for SCAIL-2", lines=3)
747
+ simple_sam3_text = gr.Textbox(
748
+ value="human character",
749
+ label="SAM3 text prompt",
750
+ info="Use one or more comma/newline-separated prompts, e.g. `human character` or `woman in red dress, man in blue jacket`.",
751
+ )
752
  with gr.Accordion("Animation options", open=True):
753
  simple_max_persons = gr.Number(value=2, precision=0, label="Max tracked subjects")
754
  simple_crop = gr.Dropdown(
 
795
  )
796
  with gr.Accordion("Reference naming", open=True):
797
  gr.Markdown(
798
+ "The Advanced Character Pack uses a simple identity convention: "
799
+ "`character_0` must match the left-most tracked subject in the driving video, "
800
+ "`character_1` the next subject to the right, and so on. "
801
+ "Name your reference files according to that left-to-right order.\n\n"
802
+ "Example: if the driving video starts with the woman on the left and the man on "
803
+ "the right, use `character_0` for the woman and `character_1` for the man.\n\n"
804
  "Upload reference images with names like:\n\n"
805
  "```text\n"
806
  "character_0__front.png\n"
 
817
  " character_1/\n"
818
  " front.png\n"
819
  "```\n\n"
820
+ "All views of the same character should use the same `character_N` prefix. "
821
+ "If the detected order is ambiguous or characters cross over, use a simple case first; "
822
+ "manual track assignment is not part of this V1."
823
  )
824
  with gr.Row():
825
  adv_refs = gr.Files(
 
835
  adv_driving = gr.Video(label="Driving video")
836
  adv_prompt = gr.Textbox(label="Prompt for SCAIL-2", lines=3)
837
  with gr.Row():
838
+ adv_sam3_text = gr.Textbox(
839
+ value="human character",
840
+ label="SAM3 text prompt",
841
+ info="Use broad prompts to detect all subjects, or comma/newline-separated prompts for distinct subjects.",
842
+ )
843
  adv_max_subjects = gr.Number(value=2, precision=0, label="Max tracked subjects")
844
  adv_run = gr.Button("Generate advanced character pack", variant="primary")
845
  adv_gallery = gr.Gallery(
 
913
 
914
 
915
  if __name__ == "__main__":
916
+ build_ui().queue(max_size=4).launch(show_error=True)