Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,3 @@
|
|
1 |
-
pip install transformers
|
2 |
import streamlit as st
|
3 |
from transformers import pipeline
|
4 |
|
@@ -31,14 +30,4 @@ target_language = st.selectbox(
|
|
31 |
# Translate button
|
32 |
if st.button("Translate"):
|
33 |
if text:
|
34 |
-
# Load the translation
|
35 |
-
translation_pipeline = load_translation_pipeline(target_language)
|
36 |
-
if translation_pipeline:
|
37 |
-
# Perform translation
|
38 |
-
translation = translation_pipeline(text)
|
39 |
-
translated_text = translation[0]['translation_text']
|
40 |
-
st.write(f"**Translated text in {target_language}:**")
|
41 |
-
st.write(translated_text)
|
42 |
-
else:
|
43 |
-
st.error("Please enter text to translate.")
|
44 |
-
streamlit run app.py
|
|
|
|
|
1 |
import streamlit as st
|
2 |
from transformers import pipeline
|
3 |
|
|
|
30 |
# Translate button
|
31 |
if st.button("Translate"):
|
32 |
if text:
|
33 |
+
# Load the translation pipe
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|