Khaidv commited on
Commit
fc2f5ac
·
verified ·
1 Parent(s): 0b0db39

Upload demo.py

Browse files
Files changed (1) hide show
  1. demo.py +4 -1
demo.py CHANGED
@@ -2,14 +2,17 @@ from src.Vocabulary import Vocabulary
2
  from src.RNNmodel import RNN
3
  import torch
4
  import gradio as gr
 
5
 
6
  device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
7
 
8
- word_embedding = vocab.Vectors(name = "word2vec.txt",
9
  unk_init = torch.Tensor.normal_)
10
 
 
11
  vocab = Vocabulary()
12
 
 
13
  words_list = list(word_embedding.stoi.keys())
14
  for word in words_list:
15
  vocab.add(word)
 
2
  from src.RNNmodel import RNN
3
  import torch
4
  import gradio as gr
5
+ import torchtext.vocab as vocab1
6
 
7
  device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
8
 
9
+ ord_embedding = vocab1.Vectors(name = "word2vec.txt",
10
  unk_init = torch.Tensor.normal_)
11
 
12
+
13
  vocab = Vocabulary()
14
 
15
+
16
  words_list = list(word_embedding.stoi.keys())
17
  for word in words_list:
18
  vocab.add(word)