Spaces:
Sleeping
Sleeping
Commit
·
92d7a7f
1
Parent(s):
be9504b
Fix import warnings and ensure minutes from RAW_recipes.csv
Browse files- Remove unused re import
- Add missing urllib.request import
- Verify minutes field uses recipe['minutes'] from database
- Clean up servings to use proper field or n_ingredients estimate
🤖 Generated with [Claude Code](https://claude.ai/code)
app.py
CHANGED
|
@@ -9,10 +9,10 @@ import uvicorn
|
|
| 9 |
import os
|
| 10 |
import pandas as pd
|
| 11 |
import ast
|
| 12 |
-
import re
|
| 13 |
from sklearn.metrics.pairwise import cosine_similarity
|
| 14 |
from sklearn.feature_extraction.text import TfidfVectorizer
|
| 15 |
import numpy as np
|
|
|
|
| 16 |
|
| 17 |
# Initialize FastAPI app
|
| 18 |
app = FastAPI(
|
|
@@ -586,7 +586,7 @@ async def get_recipe_suggestions(request: RecipeRequest):
|
|
| 586 |
ingredients=recipe['ingredients'],
|
| 587 |
steps=recipe['steps'],
|
| 588 |
minutes=int(recipe['minutes']),
|
| 589 |
-
servings=recipe.get('
|
| 590 |
nutrition=nutrition,
|
| 591 |
tags=recipe['tags'],
|
| 592 |
confidence=float(recipe.get('similarity', 0.5))
|
|
|
|
| 9 |
import os
|
| 10 |
import pandas as pd
|
| 11 |
import ast
|
|
|
|
| 12 |
from sklearn.metrics.pairwise import cosine_similarity
|
| 13 |
from sklearn.feature_extraction.text import TfidfVectorizer
|
| 14 |
import numpy as np
|
| 15 |
+
import urllib.request
|
| 16 |
|
| 17 |
# Initialize FastAPI app
|
| 18 |
app = FastAPI(
|
|
|
|
| 586 |
ingredients=recipe['ingredients'],
|
| 587 |
steps=recipe['steps'],
|
| 588 |
minutes=int(recipe['minutes']),
|
| 589 |
+
servings=recipe.get('servings', recipe.get('n_ingredients', 4)), # Use actual servings or ingredient count as estimate
|
| 590 |
nutrition=nutrition,
|
| 591 |
tags=recipe['tags'],
|
| 592 |
confidence=float(recipe.get('similarity', 0.5))
|