Spaces:
Runtime error

JoeSanchez1213 commited on
Commit
da45ee9
·
verified ·
1 Parent(s): 37013f2

Delete gemini_nano.py

Browse files
Files changed (1) hide show
  1. gemini_nano.py +0 -26
gemini_nano.py DELETED
@@ -1,26 +0,0 @@
1
- # utils/gemini_nano.py
2
- import google.generativeai as genai
3
- import os
4
-
5
- genai.configure(api_key=os.getenv("GEMINI_API_KEY"))
6
-
7
- # 文本理解 + 多模态
8
- gemini = genai.GenerativeModel('gemini-1.5-flash')
9
-
10
- # 图像生成(Nano Banana Pro / Imagen 3)
11
- imagen = genai.GenerativeModel('imagen-3.0-generate-001')
12
-
13
- def understand_image(image_pil):
14
- response = gemini.generate_content(["Give a detailed academic description of this figure/equation/table", image_pil])
15
- return response.text
16
-
17
- def chat(messages):
18
- response = gemini.generate_content(messages)
19
- return response.text
20
-
21
- def generate_image(prompt, init_image=None):
22
- contents = [prompt]
23
- if init_image:
24
- contents.append(init_image)
25
- response = imagen.generate_content(contents)
26
- return response[0]._pil_image # 返回 PIL Image