Update app.py
Browse files
app.py
CHANGED
@@ -49,7 +49,7 @@ def main():
|
|
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]) #
|
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 +104,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")
|
108 |
|
109 |
if __name__ == "__main__":
|
110 |
main()
|
|
|
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 |
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()
|