(self, text, conv, modal_type="image")
| 284 | ) |
| 285 | |
| 286 | def ask(self, text, conv, modal_type="image"): |
| 287 | assert modal_type in ["text", "image", "video"] |
| 288 | conversations = [] |
| 289 | |
| 290 | if len(conv.messages) > 0 or modal_type == "text": |
| 291 | conv.append_message(conv.roles[0], text) |
| 292 | elif modal_type == "image": |
| 293 | conv.append_message(conv.roles[0], self.image_query + "\n" + text) |
| 294 | else: |
| 295 | conv.append_message(conv.roles[0], self.video_query + "\n" + text) |
| 296 | |
| 297 | conv.append_message(conv.roles[1], None) |
| 298 | conversations.append(conv.get_prompt()) |
| 299 | return conversations |
| 300 | |
| 301 | @torch.no_grad() |
| 302 | def get_image_embedding(self, image_file): |
no test coverage detected