Aytaj commited on
Commit
8d9f984
·
1 Parent(s): f65c630

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -0
app.py CHANGED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # 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"."
2
+
3
+ import streamlit as st
4
+ from transformers import pipeline
5
+
6
+ st.title("Translate to French")
7
+
8
+ input_text = st.text_input("Enter text to translate")
9
+
10
+ if st.button("Translate"):
11
+ pipe = pipeline(model="facebook/mbart-large-cc25")
12
+ translation = pipe(input_text, target_lang="fr")[0]["translation_text"]
13
+ st.write(translation)