gsarti commited on
Commit
448a3a8
1 Parent(s): d3fc5d0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -79,11 +79,12 @@ for lang in langs:
79
  st.markdown(f"<b>PE</b>: {'<bdi>' if lang == 'ara' else ''}{dic['tgt_text']}{'</bdi>' if lang == 'ara' else ''}", unsafe_allow_html=True)
80
  st.markdown(f"<b>Aligned edits</b>:", unsafe_allow_html=True)
81
  if dic["aligned_edit"] is not None:
82
- aligned_edit = dic["aligned_edit"].replace("\\n", "\n").replace("REF:", "MT :").replace("HYP:", "PE :")
83
- if lang == 'ara':
84
- edits_reverse = aligned_edit.split("EVAL:")[1][::-1]
85
- aligned_edit = aligned_edit.split("EVAL:")[0] + edits_reverse
86
- st.text()
 
87
  else:
88
  st.text("MT : N/A\nPE : N/A\nEVAL: N/A\n")
89
  st.markdown(f"<b>Metadata</b>:", unsafe_allow_html=True)
 
79
  st.markdown(f"<b>PE</b>: {'<bdi>' if lang == 'ara' else ''}{dic['tgt_text']}{'</bdi>' if lang == 'ara' else ''}", unsafe_allow_html=True)
80
  st.markdown(f"<b>Aligned edits</b>:", unsafe_allow_html=True)
81
  if dic["aligned_edit"] is not None:
82
+ aligned_edit = dic["aligned_edit"]
83
+ if lang == 'ara' and len(dic["aligned_edit"].split("EVAL: ")) == 2:
84
+ edits_reverse = aligned_edit.split("EVAL: ")[1][::-1]
85
+ aligned_edit = aligned_edit.split("EVAL: ")[0] + "EVAL: " + edits_reverse
86
+ aligned_edit = aligned_edit.replace("\\n", "\n").replace("REF:", "MT :").replace("HYP:", "PE :")
87
+ st.text(aligned_edit)
88
  else:
89
  st.text("MT : N/A\nPE : N/A\nEVAL: N/A\n")
90
  st.markdown(f"<b>Metadata</b>:", unsafe_allow_html=True)