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

Allocation time

Browse files
Files changed (1) hide show
  1. app.py +11 -4
app.py CHANGED
@@ -1099,6 +1099,7 @@ class CameraDropdown(gr.HTML):
1099
  )
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
 
1103
  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:
1104
  input_image = input_image_debug_value[0]
@@ -1108,9 +1109,9 @@ def generate_video_example_debug(input_image, prompt, camera_lora, resolution, r
1108
  duration = total_second_length_debug_value[0]
1109
  resolution = resolution_debug_value[0]
1110
  allocation_time = allocation_time_debug_value[0]
1111
- return generate_video_example(input_image, prompt, camera_lora, resolution, radioanimated_mode, input_video, input_audio)
1112
 
1113
- def generate_video_example(input_image, prompt, camera_lora, resolution, radioanimated_mode, input_video, input_audio, progress=gr.Progress(track_tqdm=True)):
1114
 
1115
  w, h = apply_resolution(resolution)
1116
 
@@ -1128,6 +1129,7 @@ def generate_video_example(input_image, prompt, camera_lora, resolution, radioan
1128
  w,
1129
  camera_lora,
1130
  input_audio,
 
1131
  progress
1132
  )
1133
  return output_video
@@ -1145,8 +1147,12 @@ def get_duration(
1145
  width,
1146
  camera_lora,
1147
  audio_path,
 
1148
  progress
1149
  ):
 
 
 
1150
  extra_time = 0
1151
 
1152
  if audio_path is not None:
@@ -1179,6 +1185,7 @@ def generate_video(
1179
  width: int = DEFAULT_1_STAGE_WIDTH,
1180
  camera_lora: str = "No LoRA",
1181
  audio_path = None,
 
1182
  progress=gr.Progress(track_tqdm=True),
1183
  ):
1184
  """
@@ -2347,7 +2354,7 @@ with gr.Blocks(title="LTX-2 Video Distilled 🎥🔈") as demo:
2347
  input_image_debug=gr.Image(type="filepath", label="Image Debug")
2348
  input_audio_debug = gr.Audio(label="Audio Debug", type="filepath")
2349
  input_video_debug=gr.Video(label="Video Debug")
2350
- total_second_length_debug=gr.Slider(label="Duration Debug", minimum=1, maximum=120, value=5, step=0.1)
2351
  resolution_debug = gr.Dropdown(
2352
  choices=[
2353
  ["16:9", "16:9"],
@@ -2358,7 +2365,7 @@ with gr.Blocks(title="LTX-2 Video Distilled 🎥🔈") as demo:
2358
  elem_id="resolution_ui",
2359
  label="Resolution Debug")
2360
  factor_debug=gr.Slider(label="Factor Debug", minimum=1, maximum=100, value=3.2, step=0.1)
2361
- allocation_time_debug=gr.Slider(label="Allocation Debug", minimum=1, maximum=60 * 20, value=720, step=1)
2362
 
2363
  def handle_field_debug_change(
2364
  input_image_debug_data,
 
1099
  )
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]
 
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
  w,
1130
  camera_lora,
1131
  input_audio,
1132
+ allocation_time,
1133
  progress
1134
  )
1135
  return output_video
 
1147
  width,
1148
  camera_lora,
1149
  audio_path,
1150
+ allocation_time,
1151
  progress
1152
  ):
1153
+ if allocation_time is not None:
1154
+ allocation_time
1155
+
1156
  extra_time = 0
1157
 
1158
  if audio_path is not None:
 
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
  ):
1191
  """
 
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"],
 
2365
  elem_id="resolution_ui",
2366
  label="Resolution Debug")
2367
  factor_debug=gr.Slider(label="Factor Debug", minimum=1, maximum=100, value=3.2, step=0.1)
2368
+ allocation_time_debug=gr.Slider(label="Allocation Debug", minimum=1, maximum=60 * 20, value=600, step=1)
2369
 
2370
  def handle_field_debug_change(
2371
  input_image_debug_data,