Fabrice-TIERCELIN commited on
Commit
835c77e
·
verified ·
1 Parent(s): 829ee9e

Total second length

Browse files
Files changed (1) hide show
  1. app.py +34 -9
app.py CHANGED
@@ -1100,18 +1100,19 @@ class CameraDropdown(gr.HTML):
1100
 
1101
  def generate_video_example_debug(input_image, prompt, camera_lora, resolution, radioanimated_mode, input_video, input_audio, progress=gr.Progress(track_tqdm=True)):
1102
  allocation_time = None
 
1103
 
1104
  if input_image_debug_value[0] is not None or input_audio_debug_value[0] is not None or input_video_debug_value[0] is not None or prompt_debug_value[0] is not None or total_second_length_debug_value[0] is not None or allocation_time_debug_value[0] is not None or resolution_debug_value[0] is not None or factor_debug_value[0] is not None:
1105
  input_image = input_image_debug_value[0]
1106
  input_audio = input_audio_debug_value[0]
1107
  input_video = input_video_debug_value[0]
1108
  prompt = prompt_debug_value[0]
1109
- duration = total_second_length_debug_value[0]
1110
  resolution = resolution_debug_value[0]
1111
  allocation_time = allocation_time_debug_value[0]
1112
- return generate_video_example(input_image, prompt, camera_lora, resolution, radioanimated_mode, input_video, input_audio, allocation_time)
1113
 
1114
- def generate_video_example(input_image, prompt, camera_lora, resolution, radioanimated_mode, input_video, input_audio, allocation_time=None, progress=gr.Progress(track_tqdm=True)):
1115
 
1116
  w, h = apply_resolution(resolution)
1117
 
@@ -1129,6 +1130,7 @@ def generate_video_example(input_image, prompt, camera_lora, resolution, radioan
1129
  w,
1130
  camera_lora,
1131
  input_audio,
 
1132
  allocation_time,
1133
  progress
1134
  )
@@ -1147,8 +1149,9 @@ def get_duration(
1147
  width,
1148
  camera_lora,
1149
  audio_path,
1150
- allocation_time,
1151
- progress
 
1152
  ):
1153
  if allocation_time is not None:
1154
  allocation_time
@@ -1185,6 +1188,7 @@ def generate_video(
1185
  width: int = DEFAULT_1_STAGE_WIDTH,
1186
  camera_lora: str = "No LoRA",
1187
  audio_path = None,
 
1188
  allocation_time = None,
1189
  progress=gr.Progress(track_tqdm=True),
1190
  ):
@@ -1219,6 +1223,9 @@ def generate_video(
1219
  gr.Info("15s not avaiable when a LoRA or lipsync is activated, reducing to 10s for this generation")
1220
  duration = 10
1221
 
 
 
 
1222
  if audio_path is None:
1223
  print(f'generating with duration:{duration} and LoRA:{camera_lora} in {width}x{height}')
1224
  else:
@@ -2283,18 +2290,36 @@ with gr.Blocks(title="LTX-2 Video Distilled 🎥🔈") as demo:
2283
  examples=[
2284
  [
2285
  "supergirl-2.png",
2286
- "A fuzzy puppet superhero character resembling a female puppet with blonde hair and a blue superhero suit sleeping in bed and just waking up, she gradually gets up, rubbing her eyes and looking at her dog that just popped on the bed. the scene feels chaotic, comedic, and emotional with expressive puppet reactions, cinematic lighting, smooth camera motion, shallow depth of field, and high-quality puppet-style animation",
2287
  "Static",
2288
  "16:9",
2289
  "Image-to-Video",
2290
  None,
2291
  "supergirl.m4a"
2292
  ],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2293
  [
2294
  "supergirl.png",
2295
- "A fuzzy puppet superhero character resembling a female puppet with blonde hair and a blue superhero suit stands inside an icy cave made of frozen walls and icicles, she looks panicked and frantic, rapidly turning her head left and right and scanning the cave while waving her arms and shouting angrily and desperately, mouthing the words “where the hell is my dog,” her movements exaggerated and puppet-like with high energy and urgency, suddenly a second puppet dog bursts into frame from the side, jumping up excitedly and tackling her affectionately while licking her face repeatedly, she freezes in surprise and then breaks into relief and laughter as the dog continues licking her, the scene feels chaotic, comedic, and emotional with expressive puppet reactions, cinematic lighting, smooth camera motion, shallow depth of field, and high-quality puppet-style animation",
2296
  "No LoRA",
2297
- "16:9",
2298
  "Image-to-Video",
2299
  None,
2300
  None,
@@ -2354,7 +2379,7 @@ with gr.Blocks(title="LTX-2 Video Distilled 🎥🔈") as demo:
2354
  input_image_debug=gr.Image(type="filepath", label="Image Debug")
2355
  input_audio_debug = gr.Audio(label="Audio Debug", type="filepath")
2356
  input_video_debug=gr.Video(label="Video Debug")
2357
- total_second_length_debug=gr.Slider(label="Duration Debug", minimum=1, maximum=120, value=7, step=0.1)
2358
  resolution_debug = gr.Dropdown(
2359
  choices=[
2360
  ["16:9", "16:9"],
 
1100
 
1101
  def generate_video_example_debug(input_image, prompt, camera_lora, resolution, radioanimated_mode, input_video, input_audio, progress=gr.Progress(track_tqdm=True)):
1102
  allocation_time = None
1103
+ total_second_length = None
1104
 
1105
  if input_image_debug_value[0] is not None or input_audio_debug_value[0] is not None or input_video_debug_value[0] is not None or prompt_debug_value[0] is not None or total_second_length_debug_value[0] is not None or allocation_time_debug_value[0] is not None or resolution_debug_value[0] is not None or factor_debug_value[0] is not None:
1106
  input_image = input_image_debug_value[0]
1107
  input_audio = input_audio_debug_value[0]
1108
  input_video = input_video_debug_value[0]
1109
  prompt = prompt_debug_value[0]
1110
+ total_second_length = total_second_length_debug_value[0]
1111
  resolution = resolution_debug_value[0]
1112
  allocation_time = allocation_time_debug_value[0]
1113
+ return generate_video_example(input_image, prompt, camera_lora, resolution, radioanimated_mode, input_video, input_audio, total_second_length, allocation_time)
1114
 
1115
+ def generate_video_example(input_image, prompt, camera_lora, resolution, radioanimated_mode, input_video, input_audio, total_second_length=5, allocation_time=None, progress=gr.Progress(track_tqdm=True)):
1116
 
1117
  w, h = apply_resolution(resolution)
1118
 
 
1130
  w,
1131
  camera_lora,
1132
  input_audio,
1133
+ total_second_length,
1134
  allocation_time,
1135
  progress
1136
  )
 
1149
  width,
1150
  camera_lora,
1151
  audio_path,
1152
+ total_second_length = None,
1153
+ allocation_time = None,
1154
+ progress = None
1155
  ):
1156
  if allocation_time is not None:
1157
  allocation_time
 
1188
  width: int = DEFAULT_1_STAGE_WIDTH,
1189
  camera_lora: str = "No LoRA",
1190
  audio_path = None,
1191
+ total_second_length = None,
1192
  allocation_time = None,
1193
  progress=gr.Progress(track_tqdm=True),
1194
  ):
 
1223
  gr.Info("15s not avaiable when a LoRA or lipsync is activated, reducing to 10s for this generation")
1224
  duration = 10
1225
 
1226
+ if total_second_length is not None:
1227
+ duration = total_second_length
1228
+
1229
  if audio_path is None:
1230
  print(f'generating with duration:{duration} and LoRA:{camera_lora} in {width}x{height}')
1231
  else:
 
2290
  examples=[
2291
  [
2292
  "supergirl-2.png",
2293
+ "A woman wakes up.",
2294
  "Static",
2295
  "16:9",
2296
  "Image-to-Video",
2297
  None,
2298
  "supergirl.m4a"
2299
  ],
2300
+ [
2301
+ "supergirl-2.png",
2302
+ "A woman speaks.",
2303
+ "Static",
2304
+ "16:9",
2305
+ "Image-to-Video",
2306
+ None,
2307
+ None
2308
+ ],
2309
+ [
2310
+ "supergirl-2.png",
2311
+ "A woman speaks.",
2312
+ "Static",
2313
+ "16:9",
2314
+ "Image-to-Video",
2315
+ None,
2316
+ None
2317
+ ],
2318
  [
2319
  "supergirl.png",
2320
+ "A woman is stuck.",
2321
  "No LoRA",
2322
+ "9:16",
2323
  "Image-to-Video",
2324
  None,
2325
  None,
 
2379
  input_image_debug=gr.Image(type="filepath", label="Image Debug")
2380
  input_audio_debug = gr.Audio(label="Audio Debug", type="filepath")
2381
  input_video_debug=gr.Video(label="Video Debug")
2382
+ total_second_length_debug=gr.Slider(label="Duration Debug", minimum=1, maximum=120, value=15, step=0.1)
2383
  resolution_debug = gr.Dropdown(
2384
  choices=[
2385
  ["16:9", "16:9"],