File size: 883 Bytes
8defc61
 
e42b2b2
8defc61
e42b2b2
8defc61
206ed66
e42b2b2
 
ab3e62e
e42b2b2
ab3e62e
e42b2b2
 
 
206ed66
e42b2b2
 
ab3e62e
e42b2b2
 
 
ab3e62e
e42b2b2
 
 
 
 
206ed66
8defc61
e42b2b2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# 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)