chap0lin commited on
Commit
2bb6993
1 Parent(s): f90b875

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -0
app.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from gensim.models import Word2Vec
3
+ import keras
4
+ from keras.utils.data_utils import pad_sequences
5
+ import requests
6
+ import shutil
7
+ import requests
8
+
9
+ def get_model(filename, url):
10
+ response = requests.get(url, stream=True)
11
+ with open(filename, 'wb') as fin:
12
+ shutil.copyfileobj(response.raw, fin)
13
+
14
+ get_model("word2vec_xp8.model", "https://github.com/chap0lin/PPF-MCTI/blob/master/Meta10/pesos/word2vec/word2vec_xp8.model?raw=true")
15
+ reloaded_w2v_model = Word2Vec.load('word2vec_xp8.model')
16
+
17
+
18
+ def greet(name):
19
+ return list(reloaded_w2v_model.wv.vocab)
20
+
21
+ iface = gr.Interface(fn=greet, inputs="text", outputs="text")
22
+ iface.launch()