Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -18,6 +18,7 @@ tokenizer = AutoTokenizer.from_pretrained(model_checkpoint)
|
|
18 |
#streamlit stuff
|
19 |
tags = st.text_input("Input tags separated by commas")
|
20 |
text = st.text_input("Input text to classify")
|
|
|
21 |
#Methods for tag processing
|
22 |
def pool_embeddings(out, tok):
|
23 |
embeddings = out["hidden_states"][-1]
|
@@ -116,7 +117,7 @@ def extract_tokens(text,top_kp=30):
|
|
116 |
#Process text and classify it
|
117 |
if text and tags:
|
118 |
text = text.lower()
|
119 |
-
t1_tokens = extract_tokens(text)
|
120 |
t1_kps = t1_tokens.pop("KPS")
|
121 |
with torch.no_grad():
|
122 |
outputs = model(**t1_tokens)
|
|
|
18 |
#streamlit stuff
|
19 |
tags = st.text_input("Input tags separated by commas")
|
20 |
text = st.text_input("Input text to classify")
|
21 |
+
= st.slider("Number of key phrases to extract from text", 10,30,20)
|
22 |
#Methods for tag processing
|
23 |
def pool_embeddings(out, tok):
|
24 |
embeddings = out["hidden_states"][-1]
|
|
|
117 |
#Process text and classify it
|
118 |
if text and tags:
|
119 |
text = text.lower()
|
120 |
+
t1_tokens = extract_tokens(text, topkp)
|
121 |
t1_kps = t1_tokens.pop("KPS")
|
122 |
with torch.no_grad():
|
123 |
outputs = model(**t1_tokens)
|