Fabrice-TIERCELIN commited on
Commit
fba2687
·
verified ·
1 Parent(s): 321fefa
Files changed (1) hide show
  1. app.py +20 -9
app.py CHANGED
@@ -123,6 +123,7 @@ input_image_debug_value = [None]
123
  input_video_debug_value = [None]
124
  prompt_debug_value = [None]
125
  total_second_length_debug_value = [None]
 
126
 
127
  default_local_storage = {
128
  "generation-mode": "image",
@@ -1016,12 +1017,13 @@ def process(input_image,
1016
  if auto_allocation:
1017
  allocation_time = min(total_second_length * 60 * (1.5 if use_teacache else 3.0) * (1 + ((steps - 25) / 25))**2, 600)
1018
 
1019
- if input_image_debug_value[0] is not None or prompt_debug_value[0] is not None or total_second_length_debug_value[0] is not None:
1020
  input_image = input_image_debug_value[0]
1021
  prompt = prompt_debug_value[0]
1022
  total_second_length = total_second_length_debug_value[0]
1023
  allocation_time = min(total_second_length_debug_value[0] * 60 * 100, 600)
1024
- input_image_debug_value[0] = prompt_debug_value[0] = total_second_length_debug_value[0] = None
 
1025
 
1026
  if torch.cuda.device_count() == 0:
1027
  gr.Warning('Set this space to GPU config to make it work.')
@@ -1133,12 +1135,13 @@ def process_video(input_video, prompt, n_prompt, randomize_seed, seed, auto_allo
1133
  if auto_allocation:
1134
  allocation_time = min(total_second_length * 60 * (2.5 if use_teacache else 3.5) * (1 + ((steps - 25) / 25))**2, 600)
1135
 
1136
- if 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:
1137
  input_video = input_video_debug_value[0]
1138
  prompt = prompt_debug_value[0]
1139
  total_second_length = total_second_length_debug_value[0]
1140
  allocation_time = min(total_second_length_debug_value[0] * 60 * 100, 600)
1141
- input_video_debug_value[0] = prompt_debug_value[0] = total_second_length_debug_value[0] = None
 
1142
 
1143
  if torch.cuda.device_count() == 0:
1144
  gr.Warning('Set this space to GPU config to make it work.')
@@ -1345,6 +1348,7 @@ with block:
1345
  input_video_debug = gr.Video(sources='upload', label="Input Video Debug", height=320)
1346
  prompt_debug = gr.Textbox(label="Prompt Debug", value='')
1347
  total_second_length_debug = gr.Slider(label="Additional Video Length to Generate (seconds) Debug", minimum=1, maximum=120, value=1, step=0.1)
 
1348
 
1349
  with gr.Column():
1350
  warning = gr.HTML(elem_id="warning", value = "<center><big>Your computer must <u>not</u> enter into standby mode.</big><br/>On Chrome, you can force to keep a tab alive in <code>chrome://discards/</code></center>", visible = False)
@@ -1848,35 +1852,42 @@ with block:
1848
  return [gr.update(visible = False), gr.update(visible = False), gr.update(visible = False), gr.update(visible = True), gr.update(visible = False), gr.update(visible = True), gr.update(visible = True), gr.update(visible = True), gr.update(visible = True), gr.update(visible = True), gr.update(visible = True), gr.update(visible = False)]
1849
 
1850
 
1851
- def handle_field_debug_change(input_image_debug_data, input_video_debug_data, prompt_debug_data, total_second_length_debug_data):
1852
  print("handle_field_debug_change")
1853
  input_image_debug_value[0] = input_image_debug_data
1854
  input_video_debug_value[0] = input_video_debug_data
1855
  prompt_debug_value[0] = prompt_debug_data
1856
  total_second_length_debug_value[0] = total_second_length_debug_data
 
1857
  return []
1858
 
1859
  input_image_debug.upload(
1860
  fn=handle_field_debug_change,
1861
- inputs=[input_image_debug, input_video_debug, prompt_debug, total_second_length_debug],
1862
  outputs=[]
1863
  )
1864
 
1865
  input_video_debug.upload(
1866
  fn=handle_field_debug_change,
1867
- inputs=[input_image_debug, input_video_debug, prompt_debug, total_second_length_debug],
1868
  outputs=[]
1869
  )
1870
 
1871
  prompt_debug.change(
1872
  fn=handle_field_debug_change,
1873
- inputs=[input_image_debug, input_video_debug, prompt_debug, total_second_length_debug],
1874
  outputs=[]
1875
  )
1876
 
1877
  total_second_length_debug.change(
1878
  fn=handle_field_debug_change,
1879
- inputs=[input_image_debug, input_video_debug, prompt_debug, total_second_length_debug],
 
 
 
 
 
 
1880
  outputs=[]
1881
  )
1882
 
 
123
  input_video_debug_value = [None]
124
  prompt_debug_value = [None]
125
  total_second_length_debug_value = [None]
126
+ lora_file_debug_value = [None]
127
 
128
  default_local_storage = {
129
  "generation-mode": "image",
 
1017
  if auto_allocation:
1018
  allocation_time = min(total_second_length * 60 * (1.5 if use_teacache else 3.0) * (1 + ((steps - 25) / 25))**2, 600)
1019
 
1020
+ if input_image_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 lora_file_debug_value[0] is not None:
1021
  input_image = input_image_debug_value[0]
1022
  prompt = prompt_debug_value[0]
1023
  total_second_length = total_second_length_debug_value[0]
1024
  allocation_time = min(total_second_length_debug_value[0] * 60 * 100, 600)
1025
+ lora_file = lora_file_debug_value[0]
1026
+ input_image_debug_value[0] = prompt_debug_value[0] = total_second_length_debug_value[0] = lora_file_debug_value[0] = None
1027
 
1028
  if torch.cuda.device_count() == 0:
1029
  gr.Warning('Set this space to GPU config to make it work.')
 
1135
  if auto_allocation:
1136
  allocation_time = min(total_second_length * 60 * (2.5 if use_teacache else 3.5) * (1 + ((steps - 25) / 25))**2, 600)
1137
 
1138
+ if 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 lora_file_debug_value is not None:
1139
  input_video = input_video_debug_value[0]
1140
  prompt = prompt_debug_value[0]
1141
  total_second_length = total_second_length_debug_value[0]
1142
  allocation_time = min(total_second_length_debug_value[0] * 60 * 100, 600)
1143
+ lora_file = lora_file_debug_value[0]
1144
+ input_video_debug_value[0] = prompt_debug_value[0] = total_second_length_debug_value[0] = lora_file_debug_value[0] = None
1145
 
1146
  if torch.cuda.device_count() == 0:
1147
  gr.Warning('Set this space to GPU config to make it work.')
 
1348
  input_video_debug = gr.Video(sources='upload', label="Input Video Debug", height=320)
1349
  prompt_debug = gr.Textbox(label="Prompt Debug", value='')
1350
  total_second_length_debug = gr.Slider(label="Additional Video Length to Generate (seconds) Debug", minimum=1, maximum=120, value=1, step=0.1)
1351
+ lora_file_debug = gr.File(label="LoRA File", file_count="single", type="filepath")
1352
 
1353
  with gr.Column():
1354
  warning = gr.HTML(elem_id="warning", value = "<center><big>Your computer must <u>not</u> enter into standby mode.</big><br/>On Chrome, you can force to keep a tab alive in <code>chrome://discards/</code></center>", visible = False)
 
1852
  return [gr.update(visible = False), gr.update(visible = False), gr.update(visible = False), gr.update(visible = True), gr.update(visible = False), gr.update(visible = True), gr.update(visible = True), gr.update(visible = True), gr.update(visible = True), gr.update(visible = True), gr.update(visible = True), gr.update(visible = False)]
1853
 
1854
 
1855
+ def handle_field_debug_change(input_image_debug_data, input_video_debug_data, prompt_debug_data, total_second_length_debug_data, lora_file_debug_data):
1856
  print("handle_field_debug_change")
1857
  input_image_debug_value[0] = input_image_debug_data
1858
  input_video_debug_value[0] = input_video_debug_data
1859
  prompt_debug_value[0] = prompt_debug_data
1860
  total_second_length_debug_value[0] = total_second_length_debug_data
1861
+ lora_file_debug_value[0] = lora_file_debug_data
1862
  return []
1863
 
1864
  input_image_debug.upload(
1865
  fn=handle_field_debug_change,
1866
+ inputs=[input_image_debug, input_video_debug, prompt_debug, total_second_length_debug, lora_file_debug],
1867
  outputs=[]
1868
  )
1869
 
1870
  input_video_debug.upload(
1871
  fn=handle_field_debug_change,
1872
+ inputs=[input_image_debug, input_video_debug, prompt_debug, total_second_length_debug, lora_file_debug],
1873
  outputs=[]
1874
  )
1875
 
1876
  prompt_debug.change(
1877
  fn=handle_field_debug_change,
1878
+ inputs=[input_image_debug, input_video_debug, prompt_debug, total_second_length_debug, lora_file_debug],
1879
  outputs=[]
1880
  )
1881
 
1882
  total_second_length_debug.change(
1883
  fn=handle_field_debug_change,
1884
+ inputs=[input_image_debug, input_video_debug, prompt_debug, total_second_length_debug, lora_file_debug],
1885
+ outputs=[]
1886
+ )
1887
+
1888
+ lora_file_debug.upload(
1889
+ fn=handle_field_debug_change,
1890
+ inputs=[input_image_debug, input_video_debug, prompt_debug, total_second_length_debug, lora_file_debug],
1891
  outputs=[]
1892
  )
1893