File size: 520 Bytes
f95af6e
 
 
 
 
 
21ec6a9
f95af6e
21ec6a9
 
 
 
 
 
 
f95af6e
 
21ec6a9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import streamlit as st
from transformers import pipeline
#!pip install sentencepiece
pipe = pipeline("translation", model="Helsinki-NLP/opus-mt-tc-big-en-tr")

def main():
    st.title("English to Turkish Translator")

    # Use st.markdown to set the width with HTML
    input_text = st.text_area("Enter text in English:", height=100)

    if input_text:
        translation = pipe(input_text)[0]["translation_text"]
        st.write("Translation:")
        st.write(translation)

if __name__ == "__main__":
    main()