Corrupted display of Arabic text in Dataframe in Streamlit


I am trying to print a dataframe containing Arabic tweets, but almost all text is being hidden on the periphery.

Steps to reproduce

Code snippet:


    for idx, cluster in enumerate(clusters_tweets):
        df = pd.DataFrame(cluster, columns=['id', 'tweet'])
        with st.expander(label=f'Cluster {idx+1}'):

clusters_tweets is a list of lists, with each sublist containing 2-tuples of tweet and tweet ID.
Expected behavior:

I want each tweet to be displayed in its normal position in the cell.

Actual behavior:

The tweets are being shifted to the left, resulting in only a few words (if not none of them) appearing.
I want to display the tweets of each cluster in a neat way. Note that the tweets could be multiline tweets.

Debug info

Works for me using Streamlit v1.14.0.

The above problem was solved by the following pandas hack:

st.write(df.to_html(escape=False), unsafe_allow_html=True)

Thanks all anyways.

1 Like

hello Mohammed
Iā€™m interested to use streamlit in Arabic text classification

could you please contact me at: