Spaces:
Sleeping
Sleeping
| !pip install gensim | |
| import streamlit as st | |
| from gensim.models import FastText | |
| # Load the trained FastText model | |
| model_path = "fasttext_cs.model" | |
| ft_model = FastText.load(model_path) | |
| st.title("FastText Nearest Neighbors") | |
| word = st.text_input("Enter a word:") | |
| if word: | |
| if word in ft_model.wv: | |
| neighbors = ft_model.wv.most_similar(word, topn=10) | |
| st.write(neighbors) | |
| else: | |
| st.write(f"Word '{word}' not found in vocabulary.") | |