(org_img_name, func_name="update")
| 229 | |
| 230 | |
| 231 | def get_new_image_name(org_img_name, func_name="update"): |
| 232 | head_tail = os.path.split(org_img_name) |
| 233 | head = head_tail[0] |
| 234 | tail = head_tail[1] |
| 235 | name_split = tail.split('.')[0].split('_') |
| 236 | this_new_uuid = str(uuid.uuid4())[:4] |
| 237 | if len(name_split) == 1: |
| 238 | most_org_file_name = name_split[0] |
| 239 | else: |
| 240 | assert len(name_split) == 4 |
| 241 | most_org_file_name = name_split[3] |
| 242 | recent_prev_file_name = name_split[0] |
| 243 | new_file_name = f'{this_new_uuid}_{func_name}_{recent_prev_file_name}_{most_org_file_name}.png' |
| 244 | return os.path.join(head, new_file_name) |
| 245 | |
| 246 | class InstructPix2Pix: |
| 247 | def __init__(self, device): |
no outgoing calls
no test coverage detected