Spaces:
Sleeping
Sleeping
Download model/nlp.py from nutripath/nutripath-ml: direct link, hf CLI and curl.
- Browser
- Download file 232 Bytes
-
https://huggingface.co/spaces/nutripath/nutripath-ml/resolve/main/model/nlp.py
- Command line
-
hf download hf://spaces/nutripath/nutripath-ml/model/nlp.py
-
curl -L -o nlp.py https://huggingface.co/spaces/nutripath/nutripath-ml/resolve/main/model/nlp.py
232 Bytes
| from sklearn.feature_extraction.text import TfidfVectorizer | |
| def compute_tfidf(food_descriptions): | |
| vectorizer = TfidfVectorizer() | |
| tfidf_matrix = vectorizer.fit_transform(food_descriptions) | |
| return tfidf_matrix, vectorizer |