File size: 493 Bytes
69a906f
9216764
69a906f
 
168ff57
69a906f
168ff57
69a906f
168ff57
69a906f
 
 
 
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)