Spaces:
Sleeping
Sleeping
File size: 493 Bytes
8d9f984 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
# prompt: write a streamlit app that converts english text into french text when translate button is pressed. The title of page should be "Translate to French"."
import streamlit as st
from transformers import pipeline
st.title("Translate to French")
input_text = st.text_input("Enter text to translate")
if st.button("Translate"):
pipe = pipeline(model="facebook/mbart-large-cc25")
translation = pipe(input_text, target_lang="fr")[0]["translation_text"]
st.write(translation)
|