UnarineLeo commited on
Commit
b1416f5
·
verified ·
1 Parent(s): 76e0010

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -18
app.py CHANGED
@@ -23,7 +23,7 @@ col1, col2 = st.columns(2)
23
 
24
  with col1:
25
  with st.container(border=True):
26
- sample_sentence = "Vhana vhane vha kha ḓi bva u bebwa vha kha khombo ya u <mask> nga Listeriosis"
27
 
28
  if "text_input" not in st.session_state:
29
  st.session_state.text_area = ""
@@ -38,26 +38,28 @@ with col1:
38
  if st.button("Submit"):
39
  result = fill_mask(input_sentences)
40
 
41
- st.write("Examples")
42
  st.code(sample_sentence, wrap_lines=True)
43
 
44
  with col2:
45
- if 'result' in locals():
46
- if result:
47
- for sentence, predictions in result.items():
48
- for prediction in predictions:
49
- predicted_word = prediction['token_str']
50
- score = prediction['score'] * 100
51
-
52
- st.markdown(f"""
53
- <div class="bar">
54
- <div class="bar-fill" style="width: {score}%;"></div>
55
- </div>
56
- <div class="container">
57
- <div style="align-items: left;">{predicted_word}</div>
58
- <div style="align-items: right;">{score:.2f}%</div>
59
- </div>
60
- """, unsafe_allow_html=True)
 
 
61
 
62
  if 'result' in locals():
63
  if result:
 
23
 
24
  with col1:
25
  with st.container(border=True):
26
+ sample_sentence = "Vhana vhane vha kha ḓi bva u bebwa vha kha khombo ya u <mask> nga Listeriosis."
27
 
28
  if "text_input" not in st.session_state:
29
  st.session_state.text_area = ""
 
38
  if st.button("Submit"):
39
  result = fill_mask(input_sentences)
40
 
41
+ st.markdown("Examples")
42
  st.code(sample_sentence, wrap_lines=True)
43
 
44
  with col2:
45
+ with st.container(border=True):
46
+ st.markdown("Output")
47
+ if 'result' in locals():
48
+ if result:
49
+ for sentence, predictions in result.items():
50
+ for prediction in predictions:
51
+ predicted_word = prediction['token_str']
52
+ score = prediction['score'] * 100
53
+
54
+ st.markdown(f"""
55
+ <div class="bar">
56
+ <div class="bar-fill" style="width: {score}%;"></div>
57
+ </div>
58
+ <div class="container">
59
+ <div style="align-items: left;">{predicted_word}</div>
60
+ <div style="align-items: right;">{score:.2f}%</div>
61
+ </div>
62
+ """, unsafe_allow_html=True)
63
 
64
  if 'result' in locals():
65
  if result: