Gemini 모델은 처음부터 멀티모달로 빌드되어 전문 ML 모델을 학습시키지 않고도 이미지 캡셔닝, 분류, 시각적 질의 응답을 비롯한 다양한 이미지 처리 및 컴퓨터 비전 작업을 수행할 수 있습니다.
Gemini 모델은 일반적인 멀티모달 기능 외에도 추가 학습을 통해 객체 감지 및 세분화와 같은 특정 사용 사례에 대해 향상된 정확성을 제공합니다.
Gemini에 이미지 전달
다음과 같은 여러 가지 방법으로 Gemini에 이미지를 입력으로 제공할 수 있습니다.
- URL을 사용하여 이미지 전달: 공개적으로 액세스할 수 있는 이미지에 적합합니다.
- 인라인 이미지 데이터 전달: base64로 인코딩된 이미지 데이터에 적합합니다.
- File API를 사용하여 이미지 업로드: 대용량 파일 또는 여러 요청에서 이미지를 재사용하는 데 권장됩니다.
URL을 사용하여 이미지 전달
Files API를 사용하여 이미지를 업로드하고 요청에 전달할 수 있습니다 .
Python
from google import genai
client = genai.Client()
uploaded_file = client.files.upload(file="path/to/organ.jpg")
interaction = client.interactions.create(
model="gemini-3.6-flash",
input=[
{"type": "text", "text": "Caption this image."},
{
"type": "image",
"uri": uploaded_file.uri,
"mime_type": uploaded_file.mime_type
}
]
)
print(interaction.output_text)
JavaScript
import { GoogleGenAI } from "@google/genai";
const client = new GoogleGenAI({});
const uploadedFile = await client.files.upload({
file: "path/to/organ.jpg",
config: { mimeType: "image/jpeg" }
});
const interaction = await client.interactions.create({
model: "gemini-3.6-flash",
input: [
{type: "text", text: "Caption this image."},
{
type: "image",
uri: uploadedFile.uri,