Instructions to use toto10/Ooga with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use toto10/Ooga with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("toto10/Ooga", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Download extensions/microsoftexcel-controlnet/annotator/binary/__init__.py from toto10/Ooga: direct link, hf CLI and curl.
- Browser
- Download file 491 Bytes
-
https://huggingface.co/toto10/Ooga/resolve/main/extensions/microsoftexcel-controlnet/annotator/binary/__init__.py
- Command line
-
hf download hf://toto10/Ooga/extensions/microsoftexcel-controlnet/annotator/binary/__init__.py
-
curl -L -o __init__.py https://huggingface.co/toto10/Ooga/resolve/main/extensions/microsoftexcel-controlnet/annotator/binary/__init__.py
491 Bytes
| import cv2 | |
| def apply_binary(img, bin_threshold): | |
| img_gray = cv2.cvtColor(img, cv2.COLOR_RGB2GRAY) | |
| if bin_threshold == 0 or bin_threshold == 255: | |
| # Otsu's threshold | |
| otsu_threshold, img_bin = cv2.threshold(img_gray, 0, 255, cv2.THRESH_BINARY_INV + cv2.THRESH_OTSU) | |
| print("Otsu threshold:", otsu_threshold) | |
| else: | |
| _, img_bin = cv2.threshold(img_gray, bin_threshold, 255, cv2.THRESH_BINARY_INV) | |
| return cv2.cvtColor(img_bin, cv2.COLOR_GRAY2RGB) | |