Spaces:
Runtime error
Runtime error
strangekitten
commited on
Commit
•
0645c16
1
Parent(s):
8b2c4ec
Update app.py
Browse files
app.py
CHANGED
@@ -13,6 +13,7 @@ st.markdown("<img width=400px src='https://img.freepik.com/free-photo/young-pret
|
|
13 |
|
14 |
title = st.text_area("Enter the title of the article", height=20)
|
15 |
abstract = st.text_area("Enter the abstract of the article", height=350)
|
|
|
16 |
text = title + " " + abstract
|
17 |
|
18 |
tokenizer = DistilBertTokenizer.from_pretrained("distilbert-base-cased")
|
@@ -22,5 +23,5 @@ n_classes = 40
|
|
22 |
my_linear = nn.Linear(in_features=768, out_features=n_classes, bias=True)
|
23 |
my_linear.load_state_dict(torch.load(MY_LINEAR_NAME, map_location=torch.device('cpu')))
|
24 |
|
25 |
-
for ms in get_answer_with_desc(text, model, tokenizer, my_linear):
|
26 |
-
st.markdown("
|
|
|
13 |
|
14 |
title = st.text_area("Enter the title of the article", height=20)
|
15 |
abstract = st.text_area("Enter the abstract of the article", height=350)
|
16 |
+
top_k = st.slider('How many topics from top to show?', 1, 10, 3)
|
17 |
text = title + " " + abstract
|
18 |
|
19 |
tokenizer = DistilBertTokenizer.from_pretrained("distilbert-base-cased")
|
|
|
23 |
my_linear = nn.Linear(in_features=768, out_features=n_classes, bias=True)
|
24 |
my_linear.load_state_dict(torch.load(MY_LINEAR_NAME, map_location=torch.device('cpu')))
|
25 |
|
26 |
+
for ms in get_answer_with_desc(text, model, tokenizer, my_linear, top_k=top_k):
|
27 |
+
st.markdown("#### " + ms)
|