Tophness2022 commited on
Commit
383f8a4
·
1 Parent(s): ca1a6be

restored validation wizard

Browse files
Files changed (1) hide show
  1. gradio_server.py +8 -6
gradio_server.py CHANGED
@@ -139,11 +139,15 @@ def process_prompt_and_add_tasks(
139
  state_arg,
140
  image2video
141
  ):
 
 
 
 
142
  if len(prompt) ==0:
143
  return
144
  prompt, errors = prompt_parser.process_template(prompt)
145
  if len(errors) > 0:
146
- gr.Info("Error processing prompt template: " + errors)
147
  return
148
  prompts = prompt.replace("\r", "").split("\n")
149
  prompts = [prompt.strip() for prompt in prompts if len(prompt.strip())>0 and not prompt.startswith("#")]
@@ -1223,8 +1227,6 @@ def generate_video(
1223
  gr.Info(f"You have selected attention mode '{attention_mode}'. However it is not installed or supported on your system. You should either install it or switch to the default 'sdpa' attention.")
1224
  return
1225
 
1226
- #if state.get("validate_success",0) != 1:
1227
- # return
1228
  raw_resolution = resolution
1229
  width, height = resolution.split("x")
1230
  width, height = int(width), int(height)
@@ -1546,6 +1548,7 @@ def generate_video(
1546
  gen_in_progress = False
1547
  offload.unload_loras_from_model(trans)
1548
 
 
1549
  def get_new_preset_msg(advanced = True):
1550
  if advanced:
1551
  return "Enter here a Name for a Lora Preset or Choose one in the List"
@@ -2285,10 +2288,9 @@ def generate_video_tab(image2video=False):
2285
  download_loras_btn.click(fn=download_loras, inputs=[], outputs=[download_status_row, download_status, presets_column, loras_column]).then(fn=refresh_lora_list, inputs=[state, lset_name,loras_choices], outputs=[lset_name, loras_choices])
2286
  output.select(select_video, state, None )
2287
 
2288
- #generate_btn.click(
2289
- # fn=validate_wizard_prompt, inputs =[state, wizard_prompt_activated_var, wizard_variables_var, prompt, wizard_prompt, *prompt_vars] , outputs= [prompt]
2290
- #).then(
2291
  generate_btn.click(
 
 
2292
  fn=process_prompt_and_add_tasks,
2293
  inputs=[
2294
  prompt,
 
139
  state_arg,
140
  image2video
141
  ):
142
+
143
+ if state_arg.get("validate_success",0) != 1:
144
+ print("Validation failed, not adding tasks.")
145
+ return
146
  if len(prompt) ==0:
147
  return
148
  prompt, errors = prompt_parser.process_template(prompt)
149
  if len(errors) > 0:
150
+ print("Error processing prompt template: " + errors)
151
  return
152
  prompts = prompt.replace("\r", "").split("\n")
153
  prompts = [prompt.strip() for prompt in prompts if len(prompt.strip())>0 and not prompt.startswith("#")]
 
1227
  gr.Info(f"You have selected attention mode '{attention_mode}'. However it is not installed or supported on your system. You should either install it or switch to the default 'sdpa' attention.")
1228
  return
1229
 
 
 
1230
  raw_resolution = resolution
1231
  width, height = resolution.split("x")
1232
  width, height = int(width), int(height)
 
1548
  gen_in_progress = False
1549
  offload.unload_loras_from_model(trans)
1550
 
1551
+
1552
  def get_new_preset_msg(advanced = True):
1553
  if advanced:
1554
  return "Enter here a Name for a Lora Preset or Choose one in the List"
 
2288
  download_loras_btn.click(fn=download_loras, inputs=[], outputs=[download_status_row, download_status, presets_column, loras_column]).then(fn=refresh_lora_list, inputs=[state, lset_name,loras_choices], outputs=[lset_name, loras_choices])
2289
  output.select(select_video, state, None )
2290
 
 
 
 
2291
  generate_btn.click(
2292
+ fn=validate_wizard_prompt, inputs =[state, wizard_prompt_activated_var, wizard_variables_var, prompt, wizard_prompt, *prompt_vars] , outputs= [prompt]
2293
+ ).then(
2294
  fn=process_prompt_and_add_tasks,
2295
  inputs=[
2296
  prompt,