Chunakorn commited on
Commit
ea2e8d0
1 Parent(s): e20690e

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -0
app.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from transformers import pipeline
3
+
4
+ classifier = pipeline(task="translation", model="t5-base")
5
+ def main():
6
+ st.title("Translation")
7
+ st.caption('This Translator can be use with 4 language : English, French, Romanian, German')
8
+ st.caption('You can use this from with this model "translate -Current Language- to -Target Language- : -Your text-')
9
+
10
+ with st.form("text_field"):
11
+ text = st.text_area('enter some text:')
12
+ # clicked==True only when the button is clicked
13
+ clicked = st.form_submit_button("Submit text")
14
+ if clicked:
15
+ results = classifier([text])
16
+ st.json(results)
17
+
18
+ if __name__ == "__main__":
19
+ main()