Spaces:
Sleeping
Sleeping
minor midi
Browse files- text2image.py +3 -2
text2image.py
CHANGED
|
@@ -10,8 +10,9 @@ client = genai.Client(api_key=GEMINI_API_KEY)
|
|
| 10 |
# 定義「圖解釋文」功能
|
| 11 |
def explain_image(image: Image.Image):
|
| 12 |
# 直接把 PIL image 傳進去
|
| 13 |
-
response = client.generate_content(
|
| 14 |
-
|
|
|
|
| 15 |
)
|
| 16 |
# 取出回答
|
| 17 |
explanation = response.text
|
|
|
|
| 10 |
# 定義「圖解釋文」功能
|
| 11 |
def explain_image(image: Image.Image):
|
| 12 |
# 直接把 PIL image 傳進去
|
| 13 |
+
response = client.models.generate_content(
|
| 14 |
+
model="gemini-2.0-flash",
|
| 15 |
+
contents=[image, "用繁體中文描述這張圖片"],
|
| 16 |
)
|
| 17 |
# 取出回答
|
| 18 |
explanation = response.text
|