mbahrami commited on
Commit
6dd0ae0
·
1 Parent(s): d37b190

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -8
app.py CHANGED
@@ -7,18 +7,21 @@ def get_model(model):
7
  return pipeline("fill-mask", model=model)
8
 
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)
 
7
  return pipeline("fill-mask", model=model)
8
 
9
 
 
10
 
11
+
12
+ history_keyword_text = st.text_input("Enter users's history keywords (optional, i.e., 'Gates')")
13
+
14
+ text = st.text_input("Enter a text for auto completion...")
15
 
16
  model = st.selectbox("choose a model", ["roberta-base", "bert-base-uncased", "gpt2", "t5"])
17
 
18
  if text:
19
+ data_load_state = st.text('Loading model...')
20
  nlp = get_model(model)
21
+ data_load_state = st.text('Inference to model...')
22
+ result = nlp(text+' '+nlp.tokenizer.mask_token)
23
+ data_load_state.text('')
24
+ for r in result:
25
+ if r in history_keyword_text:
26
+ r['score']*=0.10
27
  st.table(result)