Spaces:
Build error
Build error
Download image_classifier.py from nabeel857/Food_Classifier_and_Recipe_Finder: direct link, hf CLI and curl.
- Browser
- Download file 280 Bytes
-
https://huggingface.co/spaces/nabeel857/Food_Classifier_and_Recipe_Finder/resolve/main/image_classifier.py
- Command line
-
hf download hf://spaces/nabeel857/Food_Classifier_and_Recipe_Finder/image_classifier.py
-
curl -L -o image_classifier.py https://huggingface.co/spaces/nabeel857/Food_Classifier_and_Recipe_Finder/resolve/main/image_classifier.py
280 Bytes
| from transformers import pipeline | |
| from PIL import Image | |
| # Function to classify food using the pipeline | |
| def classify_food_with_pipeline(image: Image): | |
| pipe = pipeline("image-classification", model="nateraw/food") | |
| result = pipe(image) | |
| return result[0]["label"] | |