guymorlan commited on
Commit
966f815
1 Parent(s): 28f75ea

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -3,10 +3,11 @@ from transformers import pipeline
3
 
4
  pipeline = pipeline(task="translation", model="guymorlan/Shami2English")
5
 
6
- st.title("Translate Levantine Arabic to English")
7
 
8
  text = st.text_input("Enter text to translate:")
 
9
 
10
  if text:
11
- result = pipeline(text, max_length=1024)
12
- st.write("Translation:", result[0]['translation_text'])
 
3
 
4
  pipeline = pipeline(task="translation", model="guymorlan/Shami2English")
5
 
6
+ st.title("Levantine Arabic to English")
7
 
8
  text = st.text_input("Enter text to translate:")
9
+ num_translations = st.selectbox("Number of Translations:", [1, 2, 3, 4, 5], index=2)
10
 
11
  if text:
12
+ result = translator(input_text, max_length=1024, num_return_sequences=num_translations, num_beams=num_translations)[0]['generated_text']
13
+ st.markdown("<div style='font-size:24px; text-align:right; direction:rtl;'>{}</div>".format(result), unsafe_allow_html=True)