Spaces:
Runtime error
Runtime error
Commit
·
ef3d628
1
Parent(s):
0412a1f
Update app.py
Browse files
app.py
CHANGED
@@ -73,18 +73,6 @@ def get_connotations(emotion, vocab):
|
|
73 |
vocab_mask = torch.from_numpy(vocab.isin(word_set).values)
|
74 |
return word_set, vocab_mask
|
75 |
|
76 |
-
@st.cache(allow_output_mutation = True)
|
77 |
-
def get_articles():
|
78 |
-
article = pd.read_csv("/proj/semafor/datasets/all-the-news-2-1.csv", nrows=10000).dropna(subset =["title","article"])
|
79 |
-
return article
|
80 |
-
|
81 |
-
|
82 |
-
@st.cache(allow_output_mutation = True)
|
83 |
-
def search_articles(keyword,article):
|
84 |
-
mask = article.title.str.contains(keyword,case=False)
|
85 |
-
temp = article.loc[mask].sample().iloc[0]
|
86 |
-
return temp["title"] + " "+ temp["article"]
|
87 |
-
|
88 |
@st.cache(allow_output_mutation = True)
|
89 |
def get_model():
|
90 |
tokenizer = RobertaTokenizerFast.from_pretrained('roberta-base')
|
|
|
73 |
vocab_mask = torch.from_numpy(vocab.isin(word_set).values)
|
74 |
return word_set, vocab_mask
|
75 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
@st.cache(allow_output_mutation = True)
|
77 |
def get_model():
|
78 |
tokenizer = RobertaTokenizerFast.from_pretrained('roberta-base')
|