chap0lin's picture
Create app.py
2bb6993
raw
history blame
657 Bytes
import gradio as gr
from gensim.models import Word2Vec
import keras
from keras.utils.data_utils import pad_sequences
import requests
import shutil
import requests
def get_model(filename, url):
response = requests.get(url, stream=True)
with open(filename, 'wb') as fin:
shutil.copyfileobj(response.raw, fin)
get_model("word2vec_xp8.model", "https://github.com/chap0lin/PPF-MCTI/blob/master/Meta10/pesos/word2vec/word2vec_xp8.model?raw=true")
reloaded_w2v_model = Word2Vec.load('word2vec_xp8.model')
def greet(name):
return list(reloaded_w2v_model.wv.vocab)
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
iface.launch()