(self, input)
| 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 | |
| 163 | class MiniCPMV2_5: |
| 164 | def __init__(self, model_path) -> None: |
no outgoing calls
no test coverage detected