Add the gpt4 vision feature in AIOS

This commit is contained in:
alexsunxl
2023-11-17 12:01:16 +08:00
parent 3bc864467e
commit 1dbb218140
8 changed files with 158 additions and 5 deletions
+9 -1
View File
@@ -228,5 +228,13 @@ class ComputeKernel:
# if task_req.state == ComputeTaskState.DONE:
# return None, task_result
# return task_req.error_str, None
def image_2_text(self, image_path: str, prompt:str, model_name:Optional[str] = None, negative_prompt = None):
task = ComputeTask()
task.set_image_2_text_params(image_path,prompt,model_name, negative_prompt)
self.run(task)
return task
async def do_image_2_text(self, image_path: str, prompt:str, model_name:Optional[str] = None, negative_prompt = None) -> ComputeTaskResult:
task = self.image_2_text(image_path,prompt, model_name, negative_prompt)
task = await self._wait_task(task)
return task.result