-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d5bbbfa
commit 8873a4d
Showing
19 changed files
with
40 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
playsound | ||
SpeechRecognition | ||
googletrans |
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import streamlit as st | ||
from googletrans import LANGUAGES, Translator | ||
|
||
def translate_text(text, source_language, target_language): | ||
translator = Translator() | ||
translated_text = translator.translate(text, src=source_language, dest=target_language).text | ||
return translated_text | ||
|
||
# UI layout | ||
st.title("Language Translator") | ||
|
||
# Dropdowns for selecting languages | ||
from_language = st.selectbox("From", list(LANGUAGES.values())) | ||
to_language = st.selectbox("To", list(LANGUAGES.values())) | ||
|
||
# Button to trigger translation | ||
if st.button("Start"): | ||
st.text("Translation in progress...") | ||
|
||
# Your translation logic here | ||
text_to_translate = "Hello, world!" # Replace this with the actual text you want to translate | ||
translated_result = translate_text(text_to_translate, from_language, to_language) | ||
|
||
# Display the translated text | ||
st.text(f"Translated text from {from_language} to {to_language}:") | ||
st.text(translated_result) | ||
|
||
# Display status | ||
st.text("Status: Ready") |