Krishna086 commited on
Commit
7d2b4d7
·
verified ·
1 Parent(s): 87e3a41

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -3
app.py CHANGED
@@ -46,10 +46,30 @@ def main():
46
 
47
  # Header
48
  st.markdown("<h1 style='text-align: center; color: #4285F4;'>Multilingual Translator</h1>", unsafe_allow_html=True)
49
- st.markdown("<p style='text-align: center; color: #666;'>Translate text like Google Translate</p>", unsafe_allow_html=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
 
51
  # Language and Input/Output Layout
52
- col1, col2 = st.columns([1, 1]) # Equal width for larger boxes
53
  with col1:
54
  detected_options = lang_detect.detect_language(st.session_state.get("input_text", "")) if st.session_state.get("input_text", "").strip() else [("Auto-detect", 1.0, "Auto-detect")]
55
  source_lang = detected_options[0][2] if detected_options[0][0] != "Auto-detect" else "Auto-detect"
@@ -104,7 +124,7 @@ def play_audio(audio_processor):
104
  target_lang = next((k for k, v in LANGUAGES.items() if v[0] == st.session_state.target_lang.split(" (")[0]), "en")
105
  audio = audio_processor.text_to_speech(st.session_state.translated_text, target_lang)
106
  if audio and audio.getbuffer().nbytes > 0:
107
- st.audio(audio, format="audio/mp3") # Removed 'key' argument
108
 
109
  if __name__ == "__main__":
110
  main()
 
46
 
47
  # Header
48
  st.markdown("<h1 style='text-align: center; color: #4285F4;'>Multilingual Translator</h1>", unsafe_allow_html=True)
49
+ st.markdown("<p style='text-align: center; color: #666;'>Effortless Multilingual Translation</p>", unsafe_allow_html=True)
50
+
51
+ # Custom CSS to override file uploader size limit display
52
+ st.markdown(
53
+ """
54
+ <style>
55
+ .stFileUploader > div > div > div {
56
+ display: none;
57
+ }
58
+ .stFileUploader label {
59
+ display: block !important;
60
+ color: #666;
61
+ font-size: 0.8em;
62
+ }
63
+ .stFileUploader label::after {
64
+ content: "Limit 1MB per file • TXT, DOCX, PDF";
65
+ }
66
+ </style>
67
+ """,
68
+ unsafe_allow_html=True
69
+ )
70
 
71
  # Language and Input/Output Layout
72
+ col1, col2 = st.columns([2, 1]) # Wider input column
73
  with col1:
74
  detected_options = lang_detect.detect_language(st.session_state.get("input_text", "")) if st.session_state.get("input_text", "").strip() else [("Auto-detect", 1.0, "Auto-detect")]
75
  source_lang = detected_options[0][2] if detected_options[0][0] != "Auto-detect" else "Auto-detect"
 
124
  target_lang = next((k for k, v in LANGUAGES.items() if v[0] == st.session_state.target_lang.split(" (")[0]), "en")
125
  audio = audio_processor.text_to_speech(st.session_state.translated_text, target_lang)
126
  if audio and audio.getbuffer().nbytes > 0:
127
+ st.audio(audio, format="audio/mp3")
128
 
129
  if __name__ == "__main__":
130
  main()