Culinary Arts & Cooking Apps · Mobile Recipe App Developers
Score Recipe Heat Levels from Dish Descriptions for UI Gauges
Static heat tags fail when home cooks customize recipes with extra chilies, hot sauces, or cooling dairy ingredients. This example shows how to evaluate free-text dish descriptions to assign a spice score along an ordered five-point heat scale. Downstream application code uses the returned score to update interactive flame gauge animations and select heat indicator icons.
Updated · Examples verified with jev-1.13.0
Interactive demo
Dynamic Flame Gauge & Cooling Splash
A curved arc heat gauge and floating cooling droplets react in real time to recipe adjustments. Visitors see how spicy additions or dairy offsets adjust heat levels.
Visitors type a dish summary or toggle ingredient twists like extra habaneros or cooling Greek yogurt into a recipe box. Each run sends one live request to the public API; results are model judgments and can vary.
Verified sample results (2 inputs, jev-1.13.0)
Vindaloo + Cooling Raita
{ "state": { "recipe_description": "Fiery Indian chicken vindaloo with spicy ghost pepper curry, served with a cooling side of mint cucumber raita made with Greek yogurt." }, "answers": { "heat_score": { "type": "score", "score": 3.85, "legend": { "0": "Level 0: Mild / Zero spice", "1": "Level 1: Subtle warmth", "2": "Level 2: Moderate kick", "3": "Level 3: Fiery spice", "4": "Level 4: Extreme heat / Pepperhead" }, "confidence": 0.88, "probabilities": { "0": 0, "1": 0, "2": 0, "3": 0.15, "4": 0.85 } }, "has_cooling_offset": { "noul": 0.99, "type": "noul" } } }Reaper & Habanero Wings
{ "state": { "recipe_description": "Extreme spicy wings coated in habanero chili oil, crushed Carolina Reaper flakes, and hot red cayenne powder." }, "answers": { "heat_score": { "type": "score", "score": 4, "legend": { "0": "Level 0: Mild / Zero spice", "1": "Level 1: Subtle warmth", "2": "Level 2: Moderate kick", "3": "Level 3: Fiery spice", "4": "Level 4: Extreme heat / Pepperhead" }, "confidence": 1, "probabilities": { "0": 0, "1": 0, "2": 0, "3": 0, "4": 1 } }, "has_cooling_offset": { "noul": 0.01, "type": "noul" } } }
The problem
The input context contains custom ingredient lists or short preparation notes submitted by users. Simple keyword matching fails to accurately reflect net spice levels when recipes combine multiple hot peppers or add neutralizing elements like sour cream. The application must analyze the overall written profile to estimate relative heat intensity without relying on rigid keyword lists.
How TypeSafe helps
In these observed examples, the request supplies a user-written recipe_description input and asks the spice_level question. The model evaluates the description against five criteria levels, returning a numeric score from 0.0 for mild dishes up to 4.0 for extreme heat. In the recorded responses, vanilla custard received a 0.0 score, serrano tacos evaluated at 2.0, and ghost pepper wings returned 4.0. Downstream application code can use this returned score value to animate an interactive heat gauge UI component and select matching spice icon graphics. The API returns structured semantic evaluations, while your application code remains responsible for UI state updates and any rendering policies.
- Input
- A short free-text dish description or ingredient combination written by a home cook.
- Decision
- Score: Rate reported heat intensity across 5 levels from 0 (mild / zero spice) to 4 (extreme fire / pepperhead).
- Next action
- Downstream code animates a heat gauge UI component and displays appropriate spice indicator icons.
Three verified examples
These responses were returned during a previous API verification. New probabilities can differ.
Primary evaluation - Medium heat serrano tacos (primary)
Expected behavior: The chicken taco recipe features fresh serrano peppers, yielding a medium spice score around index 2.
Input
{
"recipe_description": "Diced chicken seasoned with cumin and topped with chopped fresh serrano peppers, onion, and cilantro."
}Previous verification response
jev-1.13.0 ·
{
"model": "jev-1.13.0",
"usage": {
"input_tokens": 432,
"output_tokens": 19
},
"answers": {
"spice_level": {
"type": "score",
"score": 2,
"legend": {
"0": "Level 0: Mild or zero spice, sweet or dairy-neutralized dishes",
"1": "Level 1: Low heat, mild peppers like paprika or mild jalapeño",
"2": "Level 2: Medium heat, noticeable kick from serrano peppers or chili flakes",
"3": "Level 3: High heat, spicy habanero or extra hot chili sauces",
"4": "Level 4: Extreme heat, ghost pepper, reaper, or concentrated extracts"
},
"confidence": 1,
"probabilities": {
"0": 0,
"1": 0,
"2": 1,
"3": 0,
"4": 0
}
}
}
}Alternative evaluation - Extreme ghost pepper wings (alternative)
Expected behavior: The ghost pepper and reaper extract recipe produces extreme heat, evaluating near index 4.
Input
{
"recipe_description": "Crispy chicken wings tossed in raw ghost pepper sauce and super-hot Carolina Reaper extract."
}Previous verification response
jev-1.13.0 ·
{
"model": "jev-1.13.0",
"usage": {
"input_tokens": 428,
"output_tokens": 19
},
"answers": {
"spice_level": {
"type": "score",
"score": 4,
"legend": {
"0": "Level 0: Mild or zero spice, sweet or dairy-neutralized dishes",
"1": "Level 1: Low heat, mild peppers like paprika or mild jalapeño",
"2": "Level 2: Medium heat, noticeable kick from serrano peppers or chili flakes",
"3": "Level 3: High heat, spicy habanero or extra hot chili sauces",
"4": "Level 4: Extreme heat, ghost pepper, reaper, or concentrated extracts"
},
"confidence": 1,
"probabilities": {
"0": 0,
"1": 0,
"2": 0,
"3": 0,
"4": 1
}
}
}
}Edge evaluation - Mild sweet dessert with zero pepper heat (edge case)
Expected behavior: The sweet vanilla custard contains no spicy ingredients, scoring near index 0.
Input
{
"recipe_description": "Vanilla bean custard topped with fresh whipped cream and sliced strawberries."
}Previous verification response
jev-1.13.0 ·
{
"model": "jev-1.13.0",
"usage": {
"input_tokens": 423,
"output_tokens": 19
},
"answers": {
"spice_level": {
"type": "score",
"score": 0,
"legend": {
"0": "Level 0: Mild or zero spice, sweet or dairy-neutralized dishes",
"1": "Level 1: Low heat, mild peppers like paprika or mild jalapeño",
"2": "Level 2: Medium heat, noticeable kick from serrano peppers or chili flakes",
"3": "Level 3: High heat, spicy habanero or extra hot chili sauces",
"4": "Level 4: Extreme heat, ghost pepper, reaper, or concentrated extracts"
},
"confidence": 1,
"probabilities": {
"0": 1,
"1": 0,
"2": 0,
"3": 0,
"4": 0
}
}
}
}Try online
Start with a verified example, edit the request, then ask Jev. A live request is sent only when you press Try online.
Expected behavior: The chicken taco recipe features fresh serrano peppers, yielding a medium spice score around index 2.
Use non-sensitive test data. Live input goes to typesafe.pro and TypeSafe. Anonymous requests use the gateway’s free rate limit.
A position on your scale
The score can fall between levels. Confidence describes how concentrated the answer is, not whether it is correct.
import jsonfrom urllib.error import HTTPError, URLErrorfrom urllib.request import Request, urlopenBASE_URL = "https://api.typesafe.pro"payload = { "model": "jev-latest", "state": { "recipe_description": "Diced chicken seasoned with cumin and topped with chopped fresh serrano peppers, onion, and cilantro.", }, "questions": { "spice_level": { "type": "score", "criteria": [ "Level 0: Mild or zero spice, sweet or dairy-neutralized dishes", "Level 1: Low heat, mild peppers like paprika or mild jalapeño", "Level 2: Medium heat, noticeable kick from serrano peppers or chili flakes", "Level 3: High heat, spicy habanero or extra hot chili sauces", "Level 4: Extreme heat, ghost pepper, reaper, or concentrated extracts", ], "instructions": "Evaluate the net spice and heat level of the recipe description on a 5-level index from 0 to 4.", }, },}request = Request( f"{BASE_URL}/v1/systemone", data=json.dumps(payload).encode("utf-8"), headers={"Content-Type": "application/json"}, method="POST",)try: with urlopen(request, timeout=20) as response: result = json.load(response)except HTTPError as error: raise SystemExit(f"API returned HTTP {error.code}") from errorexcept URLError as error: raise SystemExit(f"Connection failed: {error.reason}") from errorprint(json.dumps(result["answers"], indent=2))Limitations and review
- This example evaluates heat intensity using a single Score question along one index continuum, though this specific layout does not restrict applications from using separate independent questions for multi-label tagging.
- Assessing dish text estimates heat based on reported ingredient descriptions, but it does not measure chemical Scoville heat units or confirm factual preparation details.
- For ambiguous or missing ingredient text, you can implement optional fallback logic in your application to display a neutral gauge setting or request clarification from the user.
Set thresholds against your own examples before relying on an automated decision.