Instructions to use Neha555Altaf/Food-nutrient-analyzer-II with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Adapters
How to use Neha555Altaf/Food-nutrient-analyzer-II with Adapters:
from adapters import AutoAdapterModel model = AutoAdapterModel.from_pretrained("undefined") model.load_adapter("Neha555Altaf/Food-nutrient-analyzer-II", set_active=True) - Notebooks
- Google Colab
- Kaggle
| import pandas as pd | |
| import gradio as gr | |
| # Load the extended food data | |
| df = pd.read_csv("food_data_extended.csv") | |
| # Convert food names to lowercase for matching | |
| df["food"] = df["food"].str.lower() | |
| # Nutrient search function | |
| def analyze_foods(food_query): | |
| food_query = food_query.lower() | |
| items = [item.strip() for item in food_query.split(",")] | |
| results = [] | |
| for item in items: | |
| match = df[df["food"].str.contains(item)] | |
| if not match.empty: | |
| results.append(match) | |
| else: | |
| results.append(pd.DataFrame([{ | |
| "food": item, | |
| "calories": "Not found", | |
| "protein": "Not found", | |
| "carbs": "Not found", | |
| "fat": "Not found" | |
| }])) | |
| final = pd.concat(results) | |
| return final.reset_index(drop=True) | |
| # Gradio UI | |
| app = gr.Interface( | |
| fn=analyze_foods, | |
| inputs=gr.Textbox(label="Enter food items (comma-separated)", placeholder="e.g. apple, rice, chicken biryani"), | |
| outputs=gr.Dataframe(label="Nutritional Information"), | |
| title="馃崕 NutriTrack AI - Food Nutrient Analyzer", | |
| description="Type any food(s) to get calories, protein, carbs & fat. Supports 200+ food items. Try: banana, pizza, milk, apple" | |
| ) | |
| app.launch() |