File size: 838 Bytes
af1d8cd | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | 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()
|