Spaces:
Runtime error
Runtime error
File size: 703 Bytes
55bcb27 966f815 55bcb27 dad63dd 45985df 55bcb27 69674a1 2a34fb5 2c2c425 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
import streamlit as st
from transformers import pipeline
pipeline = pipeline(task="translation", model="guymorlan/Shami2English")
st.title("Levantine Arabic to English")
num_translations = st.sidebar.selectbox("Number of Translations:", [1, 2, 3, 4, 5], index=2)
input_text = st.text_input("Enter ِArabic text:")
if input_text:
result = pipeline(input_text, max_length=1024, num_return_sequences=num_translations, num_beams=max(num_translations, 5))[0]['translation_text']
st.markdown("<div style='font-size:24px;'>")
for i in range(len(result)):
st.markdown("{}".format(result[i]['generated_text']), unsafe_allow_html=True)
st.markdown("<br>")
st.markdown("</div>") |