Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -2,15 +2,11 @@
|
|
2 |
import streamlit as st
|
3 |
from transformers import pipeline
|
4 |
|
5 |
-
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
-
if st.button("Translate"):
|
9 |
-
# Specify the translation task explicitly
|
10 |
-
pipe = pipeline(task="translation", model="facebook/mbart-large-cc25", tokenizer="facebook/mbart-large-cc25")
|
11 |
-
|
12 |
-
# Perform translation
|
13 |
-
translation = pipe(input_text, target_lang="fr")[0]["translation_text"]
|
14 |
-
|
15 |
-
# Display the translated text
|
16 |
-
st.write(translation)
|
|
|
2 |
import streamlit as st
|
3 |
from transformers import pipeline
|
4 |
|
5 |
+
def main():
|
6 |
+
st.title("Translate to French")
|
7 |
+
sentence = st.text_input("Enter your sentence:")
|
8 |
+
if st.button("Translate"):
|
9 |
+
pipe = pipeline(model="facebook/m2m100_418M")
|
10 |
+
translation = pipe(sentence, target_lang="fr")[0]["translation_text"]
|
11 |
+
st.write(translation)
|
12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|