nakere424 commited on
Commit
9bc72c0
1 Parent(s): f980780

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -2
app.py CHANGED
@@ -1,5 +1,6 @@
1
  from transformers import pipeline
2
  import streamlit as st
 
3
 
4
  unmasker = pipeline('fill-mask', model='distilbert-base-uncased')
5
 
@@ -8,10 +9,15 @@ def main():
8
  st.markdown('Mask a word with [MASK]. For example, **I [MASK] dog for a walk**')
9
  masked = st.text_input('Masked sentence','Please insert a sentence')
10
 
11
- if '[MASK]' is in masked.split(' '):
 
 
 
12
  output = unmasker(masked)
13
  else:
14
  print('Sentence is not masked!!!')
15
 
16
  if __name__ == "__main__":
17
- main()
 
 
 
1
  from transformers import pipeline
2
  import streamlit as st
3
+ import re
4
 
5
  unmasker = pipeline('fill-mask', model='distilbert-base-uncased')
6
 
 
9
  st.markdown('Mask a word with [MASK]. For example, **I [MASK] dog for a walk**')
10
  masked = st.text_input('Masked sentence','Please insert a sentence')
11
 
12
+ mask_str = '[MASK]'
13
+ mask_check = re.search(masked, mask_str)
14
+
15
+ if mask_check:
16
  output = unmasker(masked)
17
  else:
18
  print('Sentence is not masked!!!')
19
 
20
  if __name__ == "__main__":
21
+ main()
22
+
23
+ x = re.search("^The.*Spain$", txt)