Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,3 @@
|
|
1 |
-
|
2 |
import streamlit as st
|
3 |
|
4 |
from transformers import pipeline
|
@@ -10,15 +9,16 @@ def get_model(model):
|
|
10 |
|
11 |
text = st.text_input("Enter a text for auto completion...")
|
12 |
|
13 |
-
history_keyword_text = st.text_input("
|
14 |
|
15 |
model = st.selectbox("choose a model", ["roberta-base", "bert-base-uncased", "gpt2", "t5"])
|
16 |
|
17 |
if text:
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
|
3 |
from transformers import pipeline
|
|
|
9 |
|
10 |
text = st.text_input("Enter a text for auto completion...")
|
11 |
|
12 |
+
history_keyword_text = st.text_input("Enter users's history keywords")
|
13 |
|
14 |
model = st.selectbox("choose a model", ["roberta-base", "bert-base-uncased", "gpt2", "t5"])
|
15 |
|
16 |
if text:
|
17 |
+
data_load_state = st.text('Loading...')
|
18 |
+
nlp = get_model(model)
|
19 |
+
result = nlp(text+nlp.tokenizer.mask_token)
|
20 |
+
data_load_state.text('Loading data...done!')
|
21 |
+
for c in result:
|
22 |
+
if c in history_keyword_text:
|
23 |
+
c['score']*=0.10
|
24 |
+
st.table(result)
|