Download scripts/check_classifier.py from Mohansree/bsure-api: direct link, hf CLI and curl.
- Browser
- Download file 838 Bytes
-
https://huggingface.co/spaces/Mohansree/bsure-api/resolve/main/scripts/check_classifier.py
- Command line
-
hf download hf://spaces/Mohansree/bsure-api/scripts/check_classifier.py
-
curl -L -o check_classifier.py https://huggingface.co/spaces/Mohansree/bsure-api/resolve/main/scripts/check_classifier.py
838 Bytes
| from services.classifier import classify_garment | |
| import requests | |
| import os | |
| def test_local_classifier(): | |
| print("Testing Local Classifier with Real Image...") | |
| # Download Jeans | |
| if not os.path.exists("temp_jeans.jpg"): | |
| img_url = "https://upload.wikimedia.org/wikipedia/commons/thumb/5/5a/Jeans.jpg/440px-Jeans.jpg" | |
| with open("temp_jeans.jpg", "wb") as f: | |
| f.write(requests.get(img_url).content) | |
| # Classify | |
| cat, desc, tags = classify_garment("temp_jeans.jpg") | |
| print("\n--- RESULTS ---") | |
| print(f"Category: {cat}") | |
| print(f"Description: {desc}") | |
| print(f"Tags: {tags}") | |
| if cat == "bottom": | |
| print("✅ SUCCESS: Detected matching bottom") | |
| else: | |
| print("❌ FAILURE: Did not detect bottom") | |
| if __name__ == "__main__": | |
| test_local_classifier() | |