S-CANVAS (Saman Corp.) — DXF + DEM + AI 기반 3D 조감도 생성 엔진. ~24k LOC Python (scanvas_maker.py 7072 LOC GUI + 구조물 파서/빌더 다수). 이 커밋은 7-iter cleanup이 적용된 상태로 import: - F821 8 + B023 6: 비동기 lambda + except/loop 변수 캡처 NameError (Py3.13에서 reproduce 확인된 진짜 버그) - RUF012 4 + RUF013 1: ClassVar / implicit Optional 명시화 - F811/B905/B904/F401/F841/W293/F541/UP/SIM/RUF/PLR 700+ cleanup/modernization 신규 파일: - ruff.toml: target=py313, Korean unicode/저자 스타일/도메인 복잡도 무력화 - requirements-py313.txt: pyproj>=3.7, scipy>=1.14, numpy>=2.0.2 (Py3.13 wheel) - .gitignore: gcp-key.json, 캐시, 백업, 생성 이미지 제외 검증: ruff 0 errors, py_compile 0 errors, import 33/33 OK on Py3.13.13. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
27 lines
709 B
Python
27 lines
709 B
Python
from google import genai
|
|
from google.genai import types as gtypes
|
|
from PIL import Image
|
|
import os
|
|
|
|
client = genai.Client(
|
|
vertexai=True,
|
|
project=os.environ["GCP_PROJECT_ID"],
|
|
location="global", # gemini-3.x 이미지 모델은 글로벌 전용
|
|
)
|
|
|
|
prompt = "여기에 프롬프트"
|
|
image = Image.open("input.png")
|
|
|
|
response = client.models.generate_content(
|
|
model="gemini-3-pro-image-preview", # Nano Banana 2
|
|
contents=[prompt, image],
|
|
config=gtypes.GenerateContentConfig(
|
|
response_modalities=["IMAGE"],
|
|
),
|
|
)
|
|
|
|
for part in response.candidates[0].content.parts:
|
|
if part.inline_data:
|
|
with open("output.png", "wb") as f:
|
|
f.write(part.inline_data.data)
|