Chunakorn's picture
Upload app.py
ea2e8d0
raw
history blame
691 Bytes
import streamlit as st
from transformers import pipeline
classifier = pipeline(task="translation", model="t5-base")
def main():
st.title("Translation")
st.caption('This Translator can be use with 4 language : English, French, Romanian, German')
st.caption('You can use this from with this model "translate -Current Language- to -Target Language- : -Your text-')
with st.form("text_field"):
text = st.text_area('enter some text:')
# clicked==True only when the button is clicked
clicked = st.form_submit_button("Submit text")
if clicked:
results = classifier([text])
st.json(results)
if __name__ == "__main__":
main()