Update app.py
Browse files
app.py
CHANGED
@@ -5,7 +5,7 @@ from googletrans import Translator, LANGUAGES
|
|
5 |
|
6 |
#def translate_to_persian(text):
|
7 |
# Instantiate the Translator object
|
8 |
-
translator = Translator()
|
9 |
|
10 |
# Translate the text
|
11 |
#translation = translator.translate(text, src='en', dest='fa')
|
@@ -79,6 +79,13 @@ if uploaded_file is not None:
|
|
79 |
|
80 |
# Button to print the text from input
|
81 |
if st.button('Print Text'):
|
82 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
|
84 |
# Run this with `streamlit run your_script.py`
|
|
|
5 |
|
6 |
#def translate_to_persian(text):
|
7 |
# Instantiate the Translator object
|
8 |
+
#translator = Translator()
|
9 |
|
10 |
# Translate the text
|
11 |
#translation = translator.translate(text, src='en', dest='fa')
|
|
|
79 |
|
80 |
# Button to print the text from input
|
81 |
if st.button('Print Text'):
|
82 |
+
translator = Translator()
|
83 |
+
|
84 |
+
# Translate the text to Persian
|
85 |
+
translated_text = translator.translate(response.text, src='en', dest='fa').text
|
86 |
+
|
87 |
+
# Display the translated text
|
88 |
+
st.text_area("Translated text in Persian:", translated_text, height=150)
|
89 |
+
#st.write(translator.translate(response.text, src='en', dest='fa').text)#translate_to_persian("Hello, how are you?"))#response.text))
|
90 |
|
91 |
# Run this with `streamlit run your_script.py`
|