Spaces:
Runtime error
Runtime error
Prathamesh Sable commited on
Commit ·
f746ed1
1
Parent(s): cb44dfc
little twicks
Browse files- main.py +2 -2
- routers/product.py +1 -1
- services/productAnalyzerAgent.py +2 -2
- utils/vuforia_utils.py +1 -1
main.py
CHANGED
|
@@ -44,8 +44,8 @@ async def log_requests(request: Request, call_next):
|
|
| 44 |
request._body = body_content
|
| 45 |
response = await call_next(request)
|
| 46 |
print(f"Request: {request.method} {request.url}")
|
| 47 |
-
print(f"Data: {body_content}"[:100])
|
| 48 |
-
print(f"Headers: {request.headers}")
|
| 49 |
return response
|
| 50 |
|
| 51 |
@app.get("/api", response_class=HTMLResponse)
|
|
|
|
| 44 |
request._body = body_content
|
| 45 |
response = await call_next(request)
|
| 46 |
print(f"Request: {request.method} {request.url}")
|
| 47 |
+
# print(f"Data: {body_content}"[:100])
|
| 48 |
+
# print(f"Headers: {request.headers}")
|
| 49 |
return response
|
| 50 |
|
| 51 |
@app.get("/api", response_class=HTMLResponse)
|
routers/product.py
CHANGED
|
@@ -136,7 +136,7 @@ async def create_product(
|
|
| 136 |
|
| 137 |
# Check if the analysis results are valid
|
| 138 |
analysis_results = results.get("overall_analysis", {})
|
| 139 |
-
overall_safety_score = analysis_results.get("overall_safety_score",
|
| 140 |
suitable_diet_types = analysis_results.get("suitable_diet_types", [])
|
| 141 |
allergy_warnings = analysis_results.get("allergy_warnings", [])
|
| 142 |
usage_recommendations = analysis_results.get("usage_recommendations", "")
|
|
|
|
| 136 |
|
| 137 |
# Check if the analysis results are valid
|
| 138 |
analysis_results = results.get("overall_analysis", {})
|
| 139 |
+
overall_safety_score = analysis_results.get("overall_safety_score", 5)
|
| 140 |
suitable_diet_types = analysis_results.get("suitable_diet_types", [])
|
| 141 |
allergy_warnings = analysis_results.get("allergy_warnings", [])
|
| 142 |
usage_recommendations = analysis_results.get("usage_recommendations", "")
|
services/productAnalyzerAgent.py
CHANGED
|
@@ -59,7 +59,7 @@ User has the following preferences:
|
|
| 59 |
|
| 60 |
You are an expert food scientist and nutritionist analyzing a product's ingredients.
|
| 61 |
Based on the detailed information about each ingredient below, provide a comprehensive
|
| 62 |
-
analysis that would be helpful for a consumer viewing this
|
| 63 |
|
| 64 |
## INGREDIENTS INFORMATION:
|
| 65 |
{''.join(ingredients_summary)}
|
|
@@ -67,7 +67,7 @@ analysis that would be helpful for a consumer viewing this in an AR application.
|
|
| 67 |
{user_context}
|
| 68 |
|
| 69 |
## REQUIRED ANALYSIS:
|
| 70 |
-
1. Overall Safety Score (1-10): Calculate this based on individual ingredient safety scores
|
| 71 |
2. Suitable Diet Types: Determine if this product is for vegan, vegetarian, or Non-Vegetarian
|
| 72 |
3. Allergy Warnings: Flag any potential allergens present related to food not more than 5 combine if needed
|
| 73 |
4. Usage Recommendations: Provide safe consumption limits or usage guidance
|
|
|
|
| 59 |
|
| 60 |
You are an expert food scientist and nutritionist analyzing a product's ingredients.
|
| 61 |
Based on the detailed information about each ingredient below, provide a comprehensive
|
| 62 |
+
analysis that would be helpful for a consumer viewing this while shopping and using that product.
|
| 63 |
|
| 64 |
## INGREDIENTS INFORMATION:
|
| 65 |
{''.join(ingredients_summary)}
|
|
|
|
| 67 |
{user_context}
|
| 68 |
|
| 69 |
## REQUIRED ANALYSIS:
|
| 70 |
+
1. Overall Safety Score (1-10): Calculate this based on individual ingredient safety scores 1 means product is not safe at all (like a toxin) and 10 means product is completely safe
|
| 71 |
2. Suitable Diet Types: Determine if this product is for vegan, vegetarian, or Non-Vegetarian
|
| 72 |
3. Allergy Warnings: Flag any potential allergens present related to food not more than 5 combine if needed
|
| 73 |
4. Usage Recommendations: Provide safe consumption limits or usage guidance
|
utils/vuforia_utils.py
CHANGED
|
@@ -33,7 +33,7 @@ async def add_target_to_vuforia(image_name: str, image_path: str) -> str:
|
|
| 33 |
# Create payload
|
| 34 |
payload = {
|
| 35 |
"name": image_name,
|
| 36 |
-
"width":
|
| 37 |
"image": image_base64,
|
| 38 |
"active_flag": True,
|
| 39 |
}
|
|
|
|
| 33 |
# Create payload
|
| 34 |
payload = {
|
| 35 |
"name": image_name,
|
| 36 |
+
"width": 150.0, # Default width in scene units
|
| 37 |
"image": image_base64,
|
| 38 |
"active_flag": True,
|
| 39 |
}
|