mbahrami commited on
Commit
d37b190
·
1 Parent(s): 665444e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -9
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("Users's history keyword split with ','")
14
 
15
  model = st.selectbox("choose a model", ["roberta-base", "bert-base-uncased", "gpt2", "t5"])
16
 
17
  if text:
18
- data_load_state = st.text('Loading...')
19
- nlp = get_model(model)
20
- result = nlp(text+nlp.tokenizer.mask_token)
21
- data_load_state.text('Loading data...done!')
22
- # for c in result:
23
- # del c["token"]
24
- st.table(result)
 
 
 
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)