Krishna086 commited on
Commit
54945d2
·
verified ·
1 Parent(s): c55f7e1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -2
app.py CHANGED
@@ -52,7 +52,7 @@ def main():
52
  st.markdown("<h1 style='text-align: center; color: #4285F4;'>Multilingual Translator</h1>", unsafe_allow_html=True)
53
  st.markdown("<p style='text-align: center; color: #666;'>Effortless Multilingual Translation</p>", unsafe_allow_html=True)
54
 
55
- # Custom CSS to hide size limit and white box, show only file types
56
  st.markdown(
57
  """
58
  <style>
@@ -83,6 +83,12 @@ def main():
83
  .stFileUploader [data-testid="stFileUploader"] {
84
  background: none !important;
85
  }
 
 
 
 
 
 
86
  </style>
87
  """,
88
  unsafe_allow_html=True
@@ -96,11 +102,11 @@ def main():
96
  source_lang_code = next((k for k, v in LANGUAGES.items() if v[1] == source_language), "en") if source_language != "Auto-detect" else "auto"
97
  source_options = ["Auto-detect"] + [f"{v[0]} ({v[1]})" for v in LANGUAGES.values()]
98
  st.selectbox("Source Language", options=source_options, index=0 if source_language == "Auto-detect" else source_options.index(f"{LANGUAGES[source_lang_code][0]} ({source_language})"), key="source_lang")
99
- st.button("Translate", key="translate_btn", on_click=trigger_translation, args=(translation_module, language_detector, audio_processor_module))
100
  user_input_text = st.text_area("Input Text", height=200, key="user_input_text", placeholder="Enter text here", label_visibility="hidden")
101
  input_type = st.radio("Input Type", ["Text", "File"], horizontal=True, label_visibility="hidden", key="input_type")
102
  if input_type == "File":
103
  st.file_uploader("Upload File", type=["txt", "docx", "pdf"], key="file_input", on_change=on_file_upload, label_visibility="hidden")
 
104
  with right_col:
105
  source_lang_display = st.session_state.source_lang.split(" (")[0] if " (" in st.session_state.source_lang else st.session_state.source_lang
106
  target_options = [f"{v[0]} ({v[1]})" for v in LANGUAGES.values() if v[0] != source_lang_display and v[1] != source_lang_display]
 
52
  st.markdown("<h1 style='text-align: center; color: #4285F4;'>Multilingual Translator</h1>", unsafe_allow_html=True)
53
  st.markdown("<p style='text-align: center; color: #666;'>Effortless Multilingual Translation</p>", unsafe_allow_html=True)
54
 
55
+ # Custom CSS to hide size limit and white box, reduce spacing
56
  st.markdown(
57
  """
58
  <style>
 
83
  .stFileUploader [data-testid="stFileUploader"] {
84
  background: none !important;
85
  }
86
+ .stRadio > div {
87
+ margin-bottom: 0 !important;
88
+ }
89
+ .stTextArea {
90
+ margin-top: 0 !important;
91
+ }
92
  </style>
93
  """,
94
  unsafe_allow_html=True
 
102
  source_lang_code = next((k for k, v in LANGUAGES.items() if v[1] == source_language), "en") if source_language != "Auto-detect" else "auto"
103
  source_options = ["Auto-detect"] + [f"{v[0]} ({v[1]})" for v in LANGUAGES.values()]
104
  st.selectbox("Source Language", options=source_options, index=0 if source_language == "Auto-detect" else source_options.index(f"{LANGUAGES[source_lang_code][0]} ({source_language})"), key="source_lang")
 
105
  user_input_text = st.text_area("Input Text", height=200, key="user_input_text", placeholder="Enter text here", label_visibility="hidden")
106
  input_type = st.radio("Input Type", ["Text", "File"], horizontal=True, label_visibility="hidden", key="input_type")
107
  if input_type == "File":
108
  st.file_uploader("Upload File", type=["txt", "docx", "pdf"], key="file_input", on_change=on_file_upload, label_visibility="hidden")
109
+ st.button("Translate", key="translate_btn", on_click=trigger_translation, args=(translation_module, language_detector, audio_processor_module))
110
  with right_col:
111
  source_lang_display = st.session_state.source_lang.split(" (")[0] if " (" in st.session_state.source_lang else st.session_state.source_lang
112
  target_options = [f"{v[0]} ({v[1]})" for v in LANGUAGES.values() if v[0] != source_lang_display and v[1] != source_lang_display]