Update text2image.py
Browse files- text2image.py +2 -2
text2image.py
CHANGED
|
@@ -12,7 +12,7 @@ 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
|
|
@@ -20,7 +20,7 @@ def explain_image(image: Image.Image):
|
|
| 20 |
|
| 21 |
# Gradio 介面
|
| 22 |
with gr.Blocks() as demo:
|
| 23 |
-
gr.Markdown("## 🧠(
|
| 24 |
image_input = gr.Image(type="pil", label="上傳圖片")
|
| 25 |
explain_button = gr.Button("解釋圖片")
|
| 26 |
output_text = gr.Textbox(label="圖片說明", lines=5)
|
|
|
|
| 12 |
# 直接把 PIL image 傳進去
|
| 13 |
response = client.models.generate_content(
|
| 14 |
model="gemini-2.0-flash",
|
| 15 |
+
contents=[image, "使用法語描述這張圖片"],
|
| 16 |
)
|
| 17 |
# 取出回答
|
| 18 |
explanation = response.text
|
|
|
|
| 20 |
|
| 21 |
# Gradio 介面
|
| 22 |
with gr.Blocks() as demo:
|
| 23 |
+
gr.Markdown("## 🧠(B11090070)Gemini 圖片解釋器(圖 ➜ 文)")
|
| 24 |
image_input = gr.Image(type="pil", label="上傳圖片")
|
| 25 |
explain_button = gr.Button("解釋圖片")
|
| 26 |
output_text = gr.Textbox(label="圖片說明", lines=5)
|