AMR-KELEG's picture
Adapt the demo to the Franco Arabic Transliteration
e42b2b2
raw
history blame contribute delete
883 Bytes
# Hint: this cheatsheet is magic! https://cheat-sheet.streamlit.app/
import streamlit as st
import pandas as pd
from franco_arabic_transliterator.franco_arabic_transliterator import FrancoArabicTransliterator
@st.cache_resource
def load_model():
return FrancoArabicTransliterator()
transliterator = load_model()
sent = st.text_input(
"Franco Arabic (Arabizi) Sentence:", placeholder="Enter an Arabizi sentence.", on_change=None
)
# TODO: Check if this is needed!
clicked = st.button("Submit")
if sent:
lexicon_transliteration = transliterator.transliterate(sent, method="lexicon")
lm_transliteration = transliterator.transliterate(sent, method="language-model")
df = pd.DataFrame(
{"method": ["Lexicon", "Language Model"],
"transliteration": [lexicon_transliteration, lm_transliteration]})
st.table(
df,
)
print(sent)