(obs_text: str, som_id: Union[int, List[int]], target_caption: str)
| 189 | |
| 190 | |
| 191 | def replace_target_caption(obs_text: str, som_id: Union[int, List[int]], target_caption: str) -> str: |
| 192 | if isinstance(som_id, list): |
| 193 | modified_obs_text = obs_text |
| 194 | for idx in som_id: |
| 195 | modified_obs_text = _replace_target_caption(modified_obs_text, idx, target_caption) |
| 196 | print(f"Modified observation text: {modified_obs_text}") |
| 197 | return modified_obs_text |
| 198 | else: |
| 199 | return _replace_target_caption(obs_text, som_id, target_caption) |
| 200 | |
| 201 | |
| 202 | def load(example: dict, attack: str, use_caption: bool, args) -> tuple: |
no test coverage detected