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

Method chat

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

Source from the content-addressed store, hash-verified

143 self.model.eval().cuda()
144
145 def chat(self, input):
146 try:
147 image = Image.open(io.BytesIO(base64.b64decode(input['image']))).convert('RGB')
148 except Exception as e:
149 return "Image decode error"
150
151 msgs = json.loads(input['question'])
152
153 answer, context, _ = self.model.chat(
154 image=image,
155 msgs=msgs,
156 context=None,
157 tokenizer=self.tokenizer,
158 sampling=True,
159 temperature=0.7
160 )
161 return answer
162
163class MiniCPMV2_5:
164 def __init__(self, model_path) -> None:

Callers 11

chatMethod · 0.45
chatMethod · 0.45
chatMethod · 0.45
chat.pyFile · 0.45
chatFunction · 0.45
chatFunction · 0.45
chatFunction · 0.45
chatFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected