feat: localize logs, colorize streams, and fix draw pipeline params
Some checks failed
Pre-commit / run (ubuntu-latest) (push) Has been cancelled
Deploy Sphinx documentation to Pages / build_en (ubuntu-latest, 3.10) (push) Has been cancelled
Deploy Sphinx documentation to Pages / build_zh (ubuntu-latest, 3.10) (push) Has been cancelled
Python Unittest Coverage / test (macos-15, 3.10) (push) Has been cancelled
Python Unittest Coverage / test (macos-15, 3.11) (push) Has been cancelled
Python Unittest Coverage / test (macos-15, 3.12) (push) Has been cancelled
Python Unittest Coverage / test (ubuntu-latest, 3.10) (push) Has been cancelled
Python Unittest Coverage / test (ubuntu-latest, 3.11) (push) Has been cancelled
Python Unittest Coverage / test (ubuntu-latest, 3.12) (push) Has been cancelled
Python Unittest Coverage / test (windows-latest, 3.10) (push) Has been cancelled
Python Unittest Coverage / test (windows-latest, 3.11) (push) Has been cancelled
Python Unittest Coverage / test (windows-latest, 3.12) (push) Has been cancelled

This commit is contained in:
2026-03-03 11:29:25 +08:00
parent ed0bc2a56d
commit 919c70789e
4 changed files with 186 additions and 22 deletions

View File

@@ -87,7 +87,8 @@ class GeminiExtractV2Service:
self,
input_path: str,
output_path: str,
custom_prompt: str = None
custom_prompt: str = None,
aspect_ratio: str = "1:1",
) -> tuple[bool, str, dict]:
"""
使用多API配置进行印花图案提取
@@ -124,7 +125,11 @@ class GeminiExtractV2Service:
headers = {
"Content-Type": "application/json"
}
image_config = {}
valid_ratios = {"1:1", "9:16", "16:9", "3:4", "4:3", "3:2", "2:3", "5:4", "4:5"}
if aspect_ratio in valid_ratios:
image_config["aspectRatio"] = aspect_ratio
data = {
"contents": [
{
@@ -143,8 +148,8 @@ class GeminiExtractV2Service:
}
],
"generationConfig": {
"responseModalities": ["IMAGE"] # 只生成图片
# 不传imageConfig让输出图片比例与输入图片一致
"responseModalities": ["IMAGE"], # 只生成图片
**({"imageConfig": image_config} if image_config else {}),
}
}
else: