Hermes Bot commited on
Commit
1e17100
·
1 Parent(s): 9ca7af9

Add global os declaration in run to fix UnboundLocalError

Browse files
core/pipelines/sd_image_pipeline.py CHANGED
@@ -84,6 +84,7 @@ class SdImagePipeline(BasePipeline):
84
  return deduped_paths
85
 
86
  def run(self, ui_inputs: Dict, progress):
 
87
  progress(0, desc="Preparing models...")
88
 
89
  task_type = ui_inputs['task_type']
@@ -247,7 +248,7 @@ class SdImagePipeline(BasePipeline):
247
  # metadata to display. We restore the behaviour here.
248
  # -----------------------------------------------------------------
249
  from PIL import Image, PngImagePlugin
250
- import json, os
251
  # Build the same param string used previously in `_gpu_logic`
252
  params_string = f"{ui_inputs['positive_prompt']}\nNegative prompt: {ui_inputs['negative_prompt']}\n"
253
  params_string += f"Steps: {ui_inputs['num_inference_steps']}, Sampler: {ui_inputs['sampler']}, Scheduler: {ui_inputs['scheduler']}, CFG scale: {ui_inputs['guidance_scale']}, Seed: {ui_inputs['seed']}, Size: {ui_inputs.get('width', 'N/A')}x{ui_inputs.get('height', 'N/A')}, Base Model: {model_display_name}"
 
84
  return deduped_paths
85
 
86
  def run(self, ui_inputs: Dict, progress):
87
+ global os
88
  progress(0, desc="Preparing models...")
89
 
90
  task_type = ui_inputs['task_type']
 
248
  # metadata to display. We restore the behaviour here.
249
  # -----------------------------------------------------------------
250
  from PIL import Image, PngImagePlugin
251
+ import json
252
  # Build the same param string used previously in `_gpu_logic`
253
  params_string = f"{ui_inputs['positive_prompt']}\nNegative prompt: {ui_inputs['negative_prompt']}\n"
254
  params_string += f"Steps: {ui_inputs['num_inference_steps']}, Sampler: {ui_inputs['sampler']}, Scheduler: {ui_inputs['scheduler']}, CFG scale: {ui_inputs['guidance_scale']}, Seed: {ui_inputs['seed']}, Size: {ui_inputs.get('width', 'N/A')}x{ui_inputs.get('height', 'N/A')}, Base Model: {model_display_name}"