Spaces:
Runtime error
Runtime error
Commit ·
10cf93a
1
Parent(s): 99a2bb9
fix: dealing with unnecessary imports
Browse files- NLPutils.py +6 -1
- app.py +0 -5
NLPutils.py
CHANGED
|
@@ -9,9 +9,14 @@ import nltk
|
|
| 9 |
import string
|
| 10 |
from gensim.utils import simple_preprocess
|
| 11 |
from nltk.corpus import stopwords
|
|
|
|
| 12 |
|
| 13 |
def load_model():
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
# Keywords for each defined topic
|
| 17 |
topic_keywords = {
|
|
|
|
| 9 |
import string
|
| 10 |
from gensim.utils import simple_preprocess
|
| 11 |
from nltk.corpus import stopwords
|
| 12 |
+
from huggingface_hub import hf_hub_download
|
| 13 |
|
| 14 |
def load_model():
|
| 15 |
+
token = "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"
|
| 16 |
+
REPO_ID = "gonzalocordova/word2vec_fastText"
|
| 17 |
+
FILENAME = "wiki.en.vec"
|
| 18 |
+
model_pth = hf_hub_download(repo_id=REPO_ID, filename=FILENAME, repo_type="model", use_auth_token=token)
|
| 19 |
+
return gensim.models.KeyedVectors.load_word2vec_format(model_pth, binary=False)
|
| 20 |
|
| 21 |
# Keywords for each defined topic
|
| 22 |
topic_keywords = {
|
app.py
CHANGED
|
@@ -1,9 +1,4 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
import numpy as np
|
| 3 |
-
import torch
|
| 4 |
-
import os
|
| 5 |
-
from torchvision import transforms
|
| 6 |
-
from huggingface_hub import hf_hub_download
|
| 7 |
import NLPutils as nlp
|
| 8 |
|
| 9 |
model = nlp.load_model()
|
|
|
|
| 1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
import NLPutils as nlp
|
| 3 |
|
| 4 |
model = nlp.load_model()
|