File size: 1,067 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 30 31 32 33 34 35 36 | from services.classifier import classify_garment
import requests
import os
def test_real():
print("Downloading sample Jeans image...")
# Get a real image of jeans
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)
print("Calling Classifier Service...")
# Check token visibility
if os.path.exists("hf_token.txt"):
print("hf_token.txt found.")
with open("hf_token.txt", "r") as f:
print(f"Token start: {f.read().strip()[:5]}...")
else:
print("❌ hf_token.txt NOT FOUND in cwd")
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_real()
|