INNER CODE UNIT · Python
simplify_to_animation_description
OpenVGLab/OmniLottie · app.py:69
def simplify_to_animation_description(text):
if not text or not isinstance(text, str):
return text
prefixes = [
r'^The video features?\s+', r'^The scene shows?\s+',
r'^An animation of\s+', r'^There is\s+', r'^It shows?\s+'
]
for pattern in prefixes:
text = re.sub(pattern, '', text, flags=re.IGNORECASE)
if text:
text = text[0].upper() + text[1:]
return text.strip()
def add_random_background(img):