Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from transformers import pipeline
|
3 |
+
#!pip install sentencepiece
|
4 |
+
pipe = pipeline("translation", model="Helsinki-NLP/opus-mt-tc-big-en-tr")
|
5 |
+
|
6 |
+
def main():
|
7 |
+
st.title("English to Turkish Translator")
|
8 |
+
|
9 |
+
# Use st.text_area with width parameter
|
10 |
+
input_text = st.text_area("Enter text in English:", height=100, width=500)
|
11 |
+
|
12 |
+
if input_text:
|
13 |
+
translation = pipe(input_text)[0]["translation_text"]
|
14 |
+
st.write("Translation:")
|
15 |
+
st.write(translation)
|
16 |
+
|
17 |
+
if __name__ == "__main__":
|
18 |
+
main()
|