Spaces:
Runtime error
Runtime error
Download models/preprocess.py from Tharuneshwar/Text-Behind-Image: direct link, hf CLI and curl.
- Browser
- Download file 496 Bytes
-
https://huggingface.co/spaces/Tharuneshwar/Text-Behind-Image/resolve/main/models/preprocess.py
- Command line
-
hf download hf://spaces/Tharuneshwar/Text-Behind-Image/models/preprocess.py
-
curl -L -o preprocess.py https://huggingface.co/spaces/Tharuneshwar/Text-Behind-Image/resolve/main/models/preprocess.py
496 Bytes
| from typing import Any, Dict, List | |
| from fastsam import FastSAM, FastSAMPrompt | |
| import numpy as np | |
| from configs.config import DEVICE, FAST_SAM_CONF, FAST_SAM_IMGSZ, FAST_SAM_IOU, FAST_SAM_RETINA_MASKS | |
| def preprocess(points_data: List[Dict]) -> Any: | |
| input_points = [] | |
| input_labels = [] | |
| for point in points_data: | |
| input_points.append([int(point['x_']), int(point['y_'])]) | |
| input_labels.append(int(point['flag_'])) | |
| return input_points, input_labels | |