6yuru99 commited on
Commit
9a950fb
1 Parent(s): 8542393

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -40
app.py CHANGED
@@ -1,41 +1,14 @@
1
- # import streamlit as st
2
- # import torch
3
- # from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
4
-
5
- # language_list = ['eng_Latn', 'zho_Hant']
6
-
7
- # st.title("Medical Translation English2Traditional Chinese")
8
-
9
-
10
- # trans_text = st.text_area(label = "Enter your text:", value="")
11
- # trans_col1, trans_col2 = st.columns(2)
12
-
13
- # with trans_col1:
14
- # src_lang = st.selectbox('Translate from:', (language_list), format_func = decode_iso)
15
- # with trans_col2:
16
- # target_lang = st.selectbox('Translate to:', (language_list), format_func = decode_iso, index=1)
17
-
18
-
19
- # if st.button("Translate"):
20
- # st.divider()
21
- # with st.spinner(":rainbow[Translating from " + decode_iso(src_lang) + " into " + decode_iso(target_lang) + ", please wait...]"):
22
- # translation = translator(trans_text, src_lang, target_lang)
23
- # translation
24
-
25
-
26
- # app.py
27
-
28
- import streamlit as st
29
- from translation_model import translator
30
-
31
- st.title("Medical Translation (en/zh)")
32
-
33
- text_input = st.text_area("Enter your text:")
34
-
35
- translation_direction = st.selectbox("Translate to", ["English -> Chinese", "Chinese -> English"])
36
-
37
- if st.button("Translate"):
38
- translated_text = translator.translate(text_input, translation_direction)
39
-
40
- st.subheader("Output:")
41
  st.write(translated_text)
 
1
+ import streamlit as st
2
+ from translation_model import translator
3
+
4
+ st.title("Medical Translation (en/zh)")
5
+
6
+ text_input = st.text_area("Enter your text:")
7
+
8
+ translation_direction = st.selectbox("Translate to", ["English -> Chinese", "Chinese -> English"])
9
+
10
+ if st.button("Translate"):
11
+ translated_text = translator.translate(text_input, translation_direction)
12
+
13
+ st.subheader("Output:")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  st.write(translated_text)