MCPcopy Index your code
hub / github.com/chenfei-wu/TaskMatrix / inference

Method inference

visual_chatgpt.py:1431–1446  ·  view source on GitHub ↗

given a image, return the picture only contains the extracted main object

(self, image_path)

Source from the content-addressed store, hash-verified

1429 "the input should be a string image_path"
1430 )
1431 def inference(self, image_path):
1432 '''
1433 given a image, return the picture only contains the extracted main object
1434 '''
1435 updated_image_path = None
1436
1437 mask = self.get_mask(image_path)
1438
1439 image = Image.open(image_path)
1440 mask = Image.fromarray(mask)
1441 image.putalpha(mask)
1442
1443 updated_image_path = get_new_image_name(image_path, func_name="detect-something")
1444 image.save(updated_image_path)
1445
1446 return updated_image_path
1447
1448 def get_mask(self, image_path):
1449 '''

Callers

nothing calls this directly

Calls 2

get_maskMethod · 0.95
get_new_image_nameFunction · 0.85

Tested by

no test coverage detected