Spaces:
Runtime error
Runtime error
Upload demo.py
Browse files
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 |
-
|
| 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)
|