stzhao commited on
Commit
f13e461
·
verified ·
1 Parent(s): 9fd6eb6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -0
app.py CHANGED
@@ -34,6 +34,7 @@ def load_models():
34
 
35
  model, tokenizer, pipe = load_models()
36
 
 
37
  def generate_enhanced_caption(image_caption, text_caption):
38
  """Generate enhanced caption using the LeX-Enhancer model"""
39
  combined_caption = f"{image_caption}, with the text on it: {text_caption}."
@@ -64,6 +65,7 @@ Below is the simple caption of an image with text. Please deduce the detailed de
64
 
65
  return combined_caption, enhanced_caption
66
 
 
67
  def generate_image(enhanced_caption, seed, num_inference_steps, guidance_scale):
68
  """Generate image using Lumina2Pipeline"""
69
  generator = torch.Generator("cpu").manual_seed(seed) if seed != 0 else None
 
34
 
35
  model, tokenizer, pipe = load_models()
36
 
37
+ @spaces.GPU
38
  def generate_enhanced_caption(image_caption, text_caption):
39
  """Generate enhanced caption using the LeX-Enhancer model"""
40
  combined_caption = f"{image_caption}, with the text on it: {text_caption}."
 
65
 
66
  return combined_caption, enhanced_caption
67
 
68
+ @spaces.GPU
69
  def generate_image(enhanced_caption, seed, num_inference_steps, guidance_scale):
70
  """Generate image using Lumina2Pipeline"""
71
  generator = torch.Generator("cpu").manual_seed(seed) if seed != 0 else None