stzhao commited on
Commit
856808b
·
verified ·
1 Parent(s): c29c340

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -40,7 +40,7 @@ def truncate_caption_by_tokens(caption, max_tokens=256):
40
  print(f"Caption was truncated from {len(tokens)} tokens to {max_tokens} tokens")
41
  return caption
42
 
43
- @spaces.GPU(duration=200)
44
  def generate_enhanced_caption(image_caption, text_caption):
45
  """Generate enhanced caption using the LeX-Enhancer model"""
46
  combined_caption = f"{image_caption}, with the text on it: {text_caption}."
@@ -73,7 +73,7 @@ Below is the simple caption of an image with text. Please deduce the detailed de
73
 
74
  return combined_caption, enhanced_caption
75
 
76
- @spaces.GPU(duration=200)
77
  def generate_image(enhanced_caption, seed, num_inference_steps, guidance_scale):
78
  """Generate image using LeX-Lumina"""
79
  # Truncate the caption if it's too long
@@ -98,7 +98,7 @@ def generate_image(enhanced_caption, seed, num_inference_steps, guidance_scale):
98
 
99
  return image
100
 
101
- @spaces.GPU(duration=200)
102
  def run_pipeline(image_caption, text_caption, seed, num_inference_steps, guidance_scale):
103
  """Run the complete pipeline from captions to final image"""
104
  combined_caption, enhanced_caption = generate_enhanced_caption(image_caption, text_caption)
 
40
  print(f"Caption was truncated from {len(tokens)} tokens to {max_tokens} tokens")
41
  return caption
42
 
43
+ @spaces.GPU(duration=40)
44
  def generate_enhanced_caption(image_caption, text_caption):
45
  """Generate enhanced caption using the LeX-Enhancer model"""
46
  combined_caption = f"{image_caption}, with the text on it: {text_caption}."
 
73
 
74
  return combined_caption, enhanced_caption
75
 
76
+ @spaces.GPU(duration=50)
77
  def generate_image(enhanced_caption, seed, num_inference_steps, guidance_scale):
78
  """Generate image using LeX-Lumina"""
79
  # Truncate the caption if it's too long
 
98
 
99
  return image
100
 
101
+ @spaces.GPU(duration=100)
102
  def run_pipeline(image_caption, text_caption, seed, num_inference_steps, guidance_scale):
103
  """Run the complete pipeline from captions to final image"""
104
  combined_caption, enhanced_caption = generate_enhanced_caption(image_caption, text_caption)