UnarineLeo commited on
Commit
36c8dd5
1 Parent(s): edebde4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -21,9 +21,9 @@ def replace_mask(sentence, predicted_word):
21
  return sentence.replace("<mask>", f"**{predicted_word}**")
22
 
23
  st.title("Fill Mask | Zabantu-XLM-Roberta")
24
- st.write(f"")
25
 
26
- st.markdown("Zabantu-XLMR refers to a fleet of models trained on different combinations of South African Bantu languages. These include: Zabantu-VEN, Zabantu-NSO, Zabantu-NSO+VEN, Zabantu-SOT+VEN, Zabantu-BANTU(from 9 South African Bantu languages)")
27
 
28
  col1, col2 = st.columns(2)
29
 
@@ -49,17 +49,17 @@ with col1:
49
  value=st.session_state['text_input']
50
  )
51
 
52
- input_sentences = {f"sentence_{i}": sentence for i, sentence in enumerate(text_input.split("\n")) if sentence}
53
 
54
  button1, button2, _ = st.columns([2, 2, 4])
55
  with button1:
56
  if st.button("Test Example"):
57
- result, warnings = fill_mask("\n".join([f"{lang}: {sentence}" for lang, sentence in sample_sentence.items()]))
58
  st.session_state['text_input'] = "\n".join([f"{lang}: {sentence}" for lang, sentence in sample_sentence.items()])
59
 
60
  with button2:
61
  if st.button("Submit"):
62
- result, warnings = fill_mask(input_sentences)
63
  st.session_state['warnings'] = warnings
64
 
65
  if st.session_state['warnings']:
 
21
  return sentence.replace("<mask>", f"**{predicted_word}**")
22
 
23
  st.title("Fill Mask | Zabantu-XLM-Roberta")
24
+ st.write("")
25
 
26
+ st.markdown("Zabantu-XLMR refers to a fleet of models trained on different combinations of South African Bantu languages.")
27
 
28
  col1, col2 = st.columns(2)
29
 
 
49
  value=st.session_state['text_input']
50
  )
51
 
52
+ input_sentences = {f"sentence_{i}": sentence for i, sentence in enumerate(text_input.split("\n")) if sentence}
53
 
54
  button1, button2, _ = st.columns([2, 2, 4])
55
  with button1:
56
  if st.button("Test Example"):
57
+ result, warnings = fill_mask(sample_sentence) # Passing the correct dictionary format
58
  st.session_state['text_input'] = "\n".join([f"{lang}: {sentence}" for lang, sentence in sample_sentence.items()])
59
 
60
  with button2:
61
  if st.button("Submit"):
62
+ result, warnings = fill_mask(input_sentences) # input_sentences is already a dictionary
63
  st.session_state['warnings'] = warnings
64
 
65
  if st.session_state['warnings']: