Nanny7 commited on
Commit
63fa4c6
·
1 Parent(s): 8d50bb7

Fix run_validation to consistently use yield instead of return

Browse files

- Changed all return statements in run_validation to yield
- This ensures consistent generator behavior for Gradio
- Fixes API schema generation issues

__pycache__/validator_gui.cpython-313.pyc CHANGED
Binary files a/__pycache__/validator_gui.cpython-313.pyc and b/__pycache__/validator_gui.cpython-313.pyc differ
 
validator_gui.py CHANGED
@@ -241,7 +241,8 @@ class ValidatorGUI:
241
  # Validate configuration
242
  errors = self.validate_config(file_path, solver_model, recon_model, num_processes, batch_size)
243
  if errors:
244
- return f"### Configuration Errors\n" + "\n".join(f"- {e}" for e in errors), None, ""
 
245
 
246
  self.is_running = True
247
  output_log = []
@@ -316,7 +317,8 @@ class ValidatorGUI:
316
  except Exception as e:
317
  error_msg = f"Failed to start validator: {str(e)}"
318
  print(f"[GUI Error] {error_msg}")
319
- return error_msg, None, ""
 
320
 
321
  # Read output
322
  lines_processed = 0
@@ -360,17 +362,18 @@ class ValidatorGUI:
360
 
361
  # Check if output file exists
362
  if os.path.exists(output_path):
363
- return output_text, output_path, final_stats
364
  else:
365
  # Try original naming convention as fallback
366
  fallback_path = file_path.replace('.xlsx', '_validated.xlsx')
367
  if os.path.exists(fallback_path):
368
- return output_text, fallback_path, final_stats
369
- return output_text, None, final_stats
 
370
 
371
  except Exception as e:
372
  stats = self.get_progress_stats()
373
- return f"Error: {str(e)}\n\n{stats}\n\n{''.join(output_log)}", None, stats
374
  finally:
375
  self.is_running = False
376
  self.process = None
 
241
  # Validate configuration
242
  errors = self.validate_config(file_path, solver_model, recon_model, num_processes, batch_size)
243
  if errors:
244
+ yield f"### Configuration Errors\n" + "\n".join(f"- {e}" for e in errors), None, ""
245
+ return
246
 
247
  self.is_running = True
248
  output_log = []
 
317
  except Exception as e:
318
  error_msg = f"Failed to start validator: {str(e)}"
319
  print(f"[GUI Error] {error_msg}")
320
+ yield error_msg, None, ""
321
+ return
322
 
323
  # Read output
324
  lines_processed = 0
 
362
 
363
  # Check if output file exists
364
  if os.path.exists(output_path):
365
+ yield output_text, output_path, final_stats
366
  else:
367
  # Try original naming convention as fallback
368
  fallback_path = file_path.replace('.xlsx', '_validated.xlsx')
369
  if os.path.exists(fallback_path):
370
+ yield output_text, fallback_path, final_stats
371
+ else:
372
+ yield output_text, None, final_stats
373
 
374
  except Exception as e:
375
  stats = self.get_progress_stats()
376
+ yield f"Error: {str(e)}\n\n{stats}\n\n{''.join(output_log)}", None, stats
377
  finally:
378
  self.is_running = False
379
  self.process = None