Update app.py
Browse files
app.py
CHANGED
@@ -41,7 +41,7 @@ def truncate_caption_by_tokens(caption, max_tokens=256):
|
|
41 |
print(f"Caption was truncated from {len(tokens)} tokens to {max_tokens} tokens")
|
42 |
return caption
|
43 |
|
44 |
-
@spaces.GPU(duration=
|
45 |
def generate_enhanced_caption(image_caption, text_caption):
|
46 |
# model.to("cuda")
|
47 |
"""Generate enhanced caption using the LeX-Enhancer model"""
|
@@ -107,7 +107,7 @@ def generate_image(enhanced_caption, seed, num_inference_steps, guidance_scale):
|
|
107 |
|
108 |
return image
|
109 |
|
110 |
-
@spaces.GPU(duration=
|
111 |
def run_pipeline(image_caption, text_caption, seed, num_inference_steps, guidance_scale, enable_enhancer):
|
112 |
"""Run the complete pipeline from captions to final image"""
|
113 |
combined_caption = f"{image_caption}, with the text on it: {text_caption}."
|
|
|
41 |
print(f"Caption was truncated from {len(tokens)} tokens to {max_tokens} tokens")
|
42 |
return caption
|
43 |
|
44 |
+
@spaces.GPU(duration=70)
|
45 |
def generate_enhanced_caption(image_caption, text_caption):
|
46 |
# model.to("cuda")
|
47 |
"""Generate enhanced caption using the LeX-Enhancer model"""
|
|
|
107 |
|
108 |
return image
|
109 |
|
110 |
+
@spaces.GPU(duration=200)
|
111 |
def run_pipeline(image_caption, text_caption, seed, num_inference_steps, guidance_scale, enable_enhancer):
|
112 |
"""Run the complete pipeline from captions to final image"""
|
113 |
combined_caption = f"{image_caption}, with the text on it: {text_caption}."
|