mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
Refactor:Introduce Image Close For GeminiCV (#9147)
### What problem does this PR solve? Introduce Image Close For GeminiCV ### Type of change - [x] Refactoring - [x] Performance Improvement
This commit is contained in:
@ -488,6 +488,7 @@ class GeminiCV(Base):
|
|||||||
img = open(BytesIO(base64.b64decode(b64)))
|
img = open(BytesIO(base64.b64decode(b64)))
|
||||||
input = [prompt, img]
|
input = [prompt, img]
|
||||||
res = self.model.generate_content(input)
|
res = self.model.generate_content(input)
|
||||||
|
img.close()
|
||||||
return res.text, res.usage_metadata.total_token_count
|
return res.text, res.usage_metadata.total_token_count
|
||||||
|
|
||||||
def describe_with_prompt(self, image, prompt=None):
|
def describe_with_prompt(self, image, prompt=None):
|
||||||
@ -500,6 +501,7 @@ class GeminiCV(Base):
|
|||||||
res = self.model.generate_content(
|
res = self.model.generate_content(
|
||||||
input,
|
input,
|
||||||
)
|
)
|
||||||
|
img.close()
|
||||||
return res.text, res.usage_metadata.total_token_count
|
return res.text, res.usage_metadata.total_token_count
|
||||||
|
|
||||||
def chat(self, system, history, gen_conf, images=[]):
|
def chat(self, system, history, gen_conf, images=[]):
|
||||||
|
|||||||
Reference in New Issue
Block a user