AlexVed commited on
Commit
f6f0134
·
verified ·
1 Parent(s): d3e8597

Update app.py

Browse files

Transfered to translation En-Ua

Files changed (1) hide show
  1. app.py +10 -5
app.py CHANGED
@@ -1,9 +1,14 @@
1
  import streamlit as st
2
  from transformers import pipeline
3
 
4
- pipe = pipeline('sentiment-analysis')
5
- text = st.text_area('Enter some text!')
6
 
7
- if text:
8
- out = pipe(text)
9
- st.json(out)
 
 
 
 
 
 
1
  import streamlit as st
2
  from transformers import pipeline
3
 
4
+ # Load translation model
5
+ translator = pipeline('translation_en_to_uk', model='Helsinki-NLP/opus-mt-en-uk')
6
 
7
+ # Streamlit UI
8
+ st.title("English to Ukrainian Translator")
9
+ text = st.text_area("Enter English text:")
10
+
11
+ if text:
12
+ translated_text = translator(text, max_length=100)[0]['translation_text']
13
+ st.subheader("Translation:")
14
+ st.write(translated_text)