Spaces:
Runtime error
Runtime error
Download test_engine_rich.py from KassimYassin/palate: direct link, hf CLI and curl.
- Browser
- Download file 1.68 kB
-
https://huggingface.co/spaces/KassimYassin/palate/resolve/main/test_engine_rich.py
- Command line
-
hf download hf://spaces/KassimYassin/palate/test_engine_rich.py
-
curl -L -o test_engine_rich.py https://huggingface.co/spaces/KassimYassin/palate/resolve/main/test_engine_rich.py
1.68 kB
| import sys | |
| if sys.platform == "win32" and hasattr(sys.stdout, "reconfigure"): | |
| sys.stdout.reconfigure(encoding="utf-8") | |
| from engine import PalateEngine | |
| print("Initializing PalateEngine with production recipe...") | |
| e = PalateEngine() | |
| print("\n1. Facets Aggregation:") | |
| facets = e.get_facets() | |
| for k, v in facets.items(): | |
| print(f" {k}: {v}") | |
| print("\n2. Testing Dietary Filters:") | |
| halal_res = e.search("shawarma", diet="halal") | |
| print(f" Halal Shawarma ({len(halal_res)} found):") | |
| for r in halal_res[:3]: | |
| print(f" - [{r['quality_score']} pts] {r['name']} ({r['neighborhood']})") | |
| print(f" Dietary: {r.get('dietary_badges')}") | |
| print(f" Craft: {r.get('craft_badges')[:2]}") | |
| vegan_res = e.search("", diet="vegan") | |
| print(f"\n Vegan Spots ({len(vegan_res)} found):") | |
| for r in vegan_res[:3]: | |
| print(f" - [{r['quality_score']} pts] {r['name']} ({r['neighborhood']}) - {r['tier_label']}") | |
| print(f" Dietary: {r.get('dietary_badges')}") | |
| print("\n3. Testing Canal Terraces:") | |
| canal_res = e.search("pizza", canal=True) | |
| print(f" Pizza with Canal Terrace ({len(canal_res)} found):") | |
| for r in canal_res[:3]: | |
| print(f" - [{r['quality_score']} pts] {r['name']} ({r['neighborhood']}) - Address: {r['address']}") | |
| print(f" Amenities: {r.get('amenity_badges')}") | |
| print("\n4. Head-to-Head Compare with Production Signals:") | |
| cmp = e.compare_head_to_head("seed_shawarma_gem", "seed_shawarma_trap") | |
| if cmp: | |
| print(f" Winner: {cmp['winner_name']}") | |
| print(f" Advantages:") | |
| for adv in cmp['advantages']: | |
| print(f" * {adv}") | |
| print(f" Recommendation: {cmp['recommendation']}") | |
| print("\nALL RICH ENGINE TESTS PASSED!") | |