techfreakworm commited on
Commit
3010ce9
·
unverified ·
1 Parent(s): 9135316

feat(ui): categorized lora_chrome — camera dropdown, detailer, IC, pose

Browse files
Files changed (1) hide show
  1. ui.py +83 -0
ui.py CHANGED
@@ -61,3 +61,86 @@ def _fmt_secs(secs: float) -> str:
61
  if secs < 60:
62
  return f"{secs}s"
63
  return f"{secs // 60}m {secs % 60}s"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
  if secs < 60:
62
  return f"{secs}s"
63
  return f"{secs // 60}m {secs % 60}s"
64
+
65
+
66
+ from dataclasses import dataclass
67
+
68
+
69
+ CAMERA_LORAS: list[str] = [
70
+ "none", "static", "dolly-in", "dolly-out", "dolly-left", "dolly-right",
71
+ "jib-up", "jib-down",
72
+ ]
73
+
74
+ IC_LORAS_BY_MODE: dict[str, list[str]] = {
75
+ "t2v": [],
76
+ "a2v": [],
77
+ "i2v": ["union", "pose-control"],
78
+ "lipsync": ["pose-control"],
79
+ "keyframe": ["union"],
80
+ "style": ["motion-track", "union"],
81
+ }
82
+
83
+
84
+ @dataclass
85
+ class LoRAComponents:
86
+ camera_lora: gr.Dropdown
87
+ camera_strength: gr.Slider
88
+ detailer_on: gr.Checkbox
89
+ detailer_strength: gr.Slider
90
+ ic_lora: gr.Dropdown | None
91
+ ic_strength: gr.Slider | None
92
+ pose_on: gr.Checkbox | None
93
+
94
+
95
+ def lora_chrome(mode: str) -> LoRAComponents:
96
+ """Categorized LoRA controls for a given mode (camera + detailer + IC + pose).
97
+
98
+ Only LoRAs relevant to the mode are surfaced. Distilled LoRA is auto-applied
99
+ by the workflow when the Fast preset is chosen — not exposed here.
100
+ """
101
+ with gr.Group():
102
+ gr.Markdown("**📷 Camera Movement**")
103
+ camera_lora = gr.Dropdown(
104
+ choices=CAMERA_LORAS, value="none", label="Camera",
105
+ info="Mutually exclusive — pick one camera direction or none.",
106
+ )
107
+ camera_strength = gr.Slider(
108
+ minimum=0.0, maximum=1.5, value=0.8, step=0.05,
109
+ label="Camera strength", visible=True,
110
+ )
111
+
112
+ with gr.Group():
113
+ gr.Markdown("**✨ Detailer**")
114
+ detailer_on = gr.Checkbox(label="Apply IC-LoRA-Detailer", value=False)
115
+ detailer_strength = gr.Slider(
116
+ minimum=0.0, maximum=1.0, value=0.5, step=0.05, label="Detailer strength",
117
+ )
118
+
119
+ ic_lora = ic_strength = pose_on = None
120
+ ic_options = IC_LORAS_BY_MODE.get(mode, [])
121
+ if ic_options:
122
+ with gr.Group():
123
+ gr.Markdown("**🎯 Image Conditioning**")
124
+ ic_lora = gr.Dropdown(
125
+ choices=["none"] + ic_options,
126
+ value=ic_options[0] if ic_options else "none",
127
+ label="IC-LoRA",
128
+ )
129
+ ic_strength = gr.Slider(
130
+ minimum=0.0, maximum=1.0, value=0.5, step=0.05, label="IC strength",
131
+ )
132
+
133
+ if mode in ("i2v", "lipsync"):
134
+ with gr.Group():
135
+ gr.Markdown("**🚶 Pose Control**")
136
+ pose_on = gr.Checkbox(label="Apply IC-LoRA-Pose-Control", value=False)
137
+
138
+ return LoRAComponents(
139
+ camera_lora=camera_lora,
140
+ camera_strength=camera_strength,
141
+ detailer_on=detailer_on,
142
+ detailer_strength=detailer_strength,
143
+ ic_lora=ic_lora,
144
+ ic_strength=ic_strength,
145
+ pose_on=pose_on,
146
+ )