ajsbsd commited on
Commit
6ea57eb
Β·
verified Β·
1 Parent(s): f3be032

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -10
app.py CHANGED
@@ -306,15 +306,15 @@ def format_generation_info(params: Dict[str, Any], generation_time: float) -> st
306
  return "\n".join(info_lines)
307
 
308
  @spaces.GPU(duration=120) # Increased duration for model loading
309
- def generate_txt2img(prompt: str, negative_prompt: str, steps: int, guidance_scale: float,
310
  width: int, height: int, seed: int, add_quality: bool) -> Tuple:
311
  """Text-to-image generation with enhanced error handling"""
312
-
313
  if not prompt.strip():
314
  return None, None, "❌ Please enter a prompt"
315
-
316
  # Lazy load models
317
- if not pipe_manager.load_models():
318
  return None, None, "❌ Failed to load model. Please try again."
319
 
320
  try:
@@ -405,18 +405,18 @@ def generate_txt2img(prompt: str, negative_prompt: str, steps: int, guidance_sca
405
  pipe_manager.clear_memory()
406
 
407
  @spaces.GPU(duration=120)
408
- def generate_img2img(input_image: Image.Image, prompt: str, negative_prompt: str,
409
- steps: int, guidance_scale: float, strength: float, seed: int,
410
  add_quality: bool) -> Tuple:
411
  """Image-to-image generation with enhanced preprocessing"""
412
-
413
  if input_image is None:
414
  return None, None, "❌ Please upload an input image"
415
-
416
  if not prompt.strip():
417
  return None, None, "❌ Please enter a prompt"
418
-
419
- if not pipe_manager.load_models():
420
  return None, None, "❌ Failed to load model. Please try again."
421
 
422
  try:
 
306
  return "\n".join(info_lines)
307
 
308
  @spaces.GPU(duration=120) # Increased duration for model loading
309
+ def generate_txt2img(prompt: str, negative_prompt: str, steps: int, guidance_scale: float,
310
  width: int, height: int, seed: int, add_quality: bool) -> Tuple:
311
  """Text-to-image generation with enhanced error handling"""
312
+
313
  if not prompt.strip():
314
  return None, None, "❌ Please enter a prompt"
315
+
316
  # Lazy load models
317
+ if not pipe_manager._load_models(): # <--- Change from load_models() to _load_models()
318
  return None, None, "❌ Failed to load model. Please try again."
319
 
320
  try:
 
405
  pipe_manager.clear_memory()
406
 
407
  @spaces.GPU(duration=120)
408
+ def generate_img2img(input_image: Image.Image, prompt: str, negative_prompt: str,
409
+ steps: int, guidance_scale: float, strength: float, seed: int,
410
  add_quality: bool) -> Tuple:
411
  """Image-to-image generation with enhanced preprocessing"""
412
+
413
  if input_image is None:
414
  return None, None, "❌ Please upload an input image"
415
+
416
  if not prompt.strip():
417
  return None, None, "❌ Please enter a prompt"
418
+
419
+ if not pipe_manager._load_models(): # <--- Change from load_models() to _load_models()
420
  return None, None, "❌ Failed to load model. Please try again."
421
 
422
  try: