Download DataModels/Region.py from Umer2762/Doctor_Handwriting_Text_Detection: direct link, hf CLI and curl.
- Browser
- Download file 1.24 kB
-
https://huggingface.co/spaces/Umer2762/Doctor_Handwriting_Text_Detection/resolve/main/DataModels/Region.py
- Command line
-
hf download hf://spaces/Umer2762/Doctor_Handwriting_Text_Detection/DataModels/Region.py
-
curl -L -o Region.py https://huggingface.co/spaces/Umer2762/Doctor_Handwriting_Text_Detection/resolve/main/DataModels/Region.py
1.24 kB
| from typing import Dict | |
| from .ShapeAttributes import ShapeAttributes | |
| from .RegionAttributes import RegionAttributes | |
| class Region: | |
| def __init__(self, shape_attributes: Dict, region_attributes: Dict): | |
| self.shape_attributes = ShapeAttributes( | |
| shape_attributes.get("x"), | |
| shape_attributes.get("y"), | |
| shape_attributes.get("width"), | |
| shape_attributes.get("height"), | |
| ) | |
| self.region_attributes = RegionAttributes( | |
| region_attributes.get("Language", "English"), | |
| region_attributes.get("Dosage", ""), | |
| region_attributes.get("Dignostic", ""), | |
| region_attributes.get("Symptoms", ""), | |
| region_attributes.get("Medicine Name", ""), | |
| region_attributes.get("Text", ""), | |
| region_attributes.get("Personal Information", "N/A"), | |
| region_attributes.get("Numeric Data", "N/A"), | |
| ) | |
| def to_dict(self): | |
| return { | |
| "shape_attributes": self.shape_attributes.to_dict(), | |
| "region_attributes": self.region_attributes.to_dict(), | |
| } | |
| def __repr__(self): | |
| return f"Region({self.shape_attributes}, {self.region_attributes})" | |