Spaces:
Runtime error
Runtime error
File size: 475 Bytes
c5840db | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | import re
def parse_resolution(resolution_str):
"""Parse resolution string into width and height"""
match = re.search(r"(\d+)\s*[×x]\s*(\d+)", resolution_str)
if match:
return int(match.group(1))), int(match.group(2)))
return 1024, 1024 # Default fallback
def clean_model_output(text):
"""Clean model output for display"""
text = re.sub(r"```.*?```", "", text, flags=re.DOTALL)
text = re.sub(r"\n+", "\n", text).strip()
return text |