project_news / app.py
Aytaj's picture
Update app.py
69a906f
raw
history blame contribute delete
No virus
493 Bytes
# 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)