Download DataModels/AnnotatedData.py from Umer2762/Doctor_Handwriting_Text_Detection: direct link, hf CLI and curl.
- Browser
- Download file 651 Bytes
-
https://huggingface.co/spaces/Umer2762/Doctor_Handwriting_Text_Detection/resolve/main/DataModels/AnnotatedData.py
- Command line
-
hf download hf://spaces/Umer2762/Doctor_Handwriting_Text_Detection/DataModels/AnnotatedData.py
-
curl -L -o AnnotatedData.py https://huggingface.co/spaces/Umer2762/Doctor_Handwriting_Text_Detection/resolve/main/DataModels/AnnotatedData.py
651 Bytes
| from typing import List, Dict, Optional | |
| from .ImageMetadata import ImageMetadata | |
| class AnnotatedData: | |
| def __init__(self, data: Dict): | |
| self.image_ids = data.get("_via_image_id_list", []) | |
| self.metadata = { | |
| img_id: ImageMetadata( | |
| data["_via_img_metadata"][img_id]["filename"], | |
| data["_via_img_metadata"][img_id]["size"], | |
| data["_via_img_metadata"][img_id].get("regions", []) | |
| ) for img_id in self.image_ids if img_id in data["_via_img_metadata"] | |
| } | |
| def __repr__(self): | |
| return f"AnnotatedData(Images={list(self.metadata.keys())})" |