rudrashah commited on
Commit
43a4171
1 Parent(s): e676301

frontend changes

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -39,7 +39,10 @@ st.write("A simple Hinglish to English translator. Enter your Hinglish text and
39
  col1, col2 = st.columns(2)
40
 
41
  with col1:
42
- hinglish_text = st.text_area("Hinglish", height=300)
 
 
 
43
 
44
  with col2:
45
  if "translated_text" in st.session_state:
@@ -50,6 +53,7 @@ with col2:
50
  if st.button("Translate", use_container_width=True, type="primary"):
51
  if hinglish_text != "":
52
  with st.spinner("Translating..."):
 
53
  translated_text = translate_hinglish_to_english(hinglish_text)
54
  st.session_state["translated_text"] = translated_text
55
  st.rerun()
 
39
  col1, col2 = st.columns(2)
40
 
41
  with col1:
42
+ if "current_text" in st.session_state:
43
+ hinglish_text = st.text_area("English", value=st.session_state["current_text"], height=300, key="x")
44
+ else:
45
+ hinglish_text = st.text_area("English", height=300, key="x")
46
 
47
  with col2:
48
  if "translated_text" in st.session_state:
 
53
  if st.button("Translate", use_container_width=True, type="primary"):
54
  if hinglish_text != "":
55
  with st.spinner("Translating..."):
56
+ st.session_state["current_text"] = hinglish_text
57
  translated_text = translate_hinglish_to_english(hinglish_text)
58
  st.session_state["translated_text"] = translated_text
59
  st.rerun()