MCPcopy Create free account
hub / github.com/TheSmallHanCat/flow2api / _aspect_from_dimensions

Function _aspect_from_dimensions

src/core/model_resolver.py:123–135  ·  view source on GitHub ↗
(width: int, height: int, *, video_mode: bool = False)

Source from the content-addressed store, hash-verified

121
122
123def _aspect_from_dimensions(width: int, height: int, *, video_mode: bool = False) -> Optional[str]:
124 if width <= 0 or height <= 0:
125 return None
126
127 ratio = width / height
128 inferred = min(
129 ASPECT_RATIO_FLOAT_MAP.items(),
130 key=lambda item: abs(ratio - item[1]),
131 )[0]
132
133 if video_mode and inferred not in {"landscape", "portrait"}:
134 return "portrait" if height > width else "landscape"
135 return inferred
136
137
138def _infer_aspect_ratio_from_images(

Callers 2

_aspect_from_openai_sizeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected