MCPcopy Create free account
hub / github.com/OpenBMB/MiniCPM-V / chat

Method chat

chat.py:169–184  ·  view source on GitHub ↗
(self, input)

Source from the content-addressed store, hash-verified

167 self.model.eval().cuda()
168
169 def chat(self, input):
170 try:
171 image = Image.open(io.BytesIO(base64.b64decode(input['image']))).convert('RGB')
172 except Exception as e:
173 return "Image decode error"
174
175 msgs = json.loads(input['question'])
176
177 answer = self.model.chat(
178 image=image,
179 msgs=msgs,
180 tokenizer=self.tokenizer,
181 sampling=True,
182 temperature=0.7
183 )
184 return answer
185
186class MiniCPMV2_6:
187 def __init__(self, model_path, multi_gpus=False) -> None:

Callers

nothing calls this directly

Calls 1

chatMethod · 0.45

Tested by

no test coverage detected