bsure-api / scripts /check_outfit_engine.py
“mohansree14”
Deploy Bsure API with correct structure
af1d8cd
Raw History Blame Contribute Delete
1.53 kB
import requests
import json
BASE_URL = "http://localhost:8001"
def test_outfit_gen():
print("Testing Smart Outfit Generation...")
# 1. Ensure user has items (Seeding if needed)
# We can assume user 1 exists from previous steps.
# Just in case, let's verify wardrobe count.
res = requests.get(f"{BASE_URL}/wardrobe/1")
items = res.json()
print(f"User 1 Wardrobe Size: {len(items)}")
for i in items:
print(f" - {i['id']}: {i['category']} ({i.get('tags')})")
if len(items) < 2:
print("⚠️ Not enough items. Please upload items manually or run previous seeds.")
# We can't easily upload here without images.
# But Phase 7 verification should have left some items.
res = requests.post(f"{BASE_URL}/outfit/generate/1")
if res.status_code == 200:
data = res.json()
print(f"RAW RESP: {data}")
print("\n--- GENERATED OUTFIT ---")
print(f"Outfit ID: {data.get('outfit_id')}")
print(f"Style Note: {data.get('note')}") # CRITICAL: This checks the new engine
print("Items:")
for item in data.get('items', []):
print(f" - {item['category'].upper()}: {item.get('tags', 'untagged')}")
if "note" in data:
print("✅ SUCCESS: Smart Engine active (Note present)")
else:
print("❌ FAILURE: Old logic active (No note)")
else:
print(f"❌ Error: {res.text}")
if __name__ == "__main__":
test_outfit_gen()