File size: 458 Bytes
9d71460
ee749a1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
!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.")