diff --git a/src/apps/pages/programs/SpeechToText/speechToText.py b/src/apps/pages/programs/SpeechToText/speechToText.py new file mode 100644 index 00000000..a2d9c975 --- /dev/null +++ b/src/apps/pages/programs/SpeechToText/speechToText.py @@ -0,0 +1,81 @@ +import streamlit as st +import streamlit.components.v1 as components + + +def speechToText(): + st.title("Speech Recognition App") + + # Embed the HTML file content in Streamlit + components.html(""" + + + + + + Speech Recognition + + + + +

+ + + + + """, height=500) diff --git a/src/apps/pages/programs/speechToTextProgram.py b/src/apps/pages/programs/speechToTextProgram.py new file mode 100644 index 00000000..d2668489 --- /dev/null +++ b/src/apps/pages/programs/speechToTextProgram.py @@ -0,0 +1,31 @@ +import os +import importlib +import streamlit as st +from src.helpers.getModules import getModules + +MAIN_DIR = 'SpeechToText' +BASE_DIR = os.path.dirname(__file__) +COMMON_MODULE_PATH = os.path.join(BASE_DIR, MAIN_DIR) +MODULES = getModules(COMMON_MODULE_PATH) + +def speechToTextProgram(): + st.title('Speech To Text') + choice = st.selectbox('Select a program to execute', [None] + list(MODULES.keys())) + st.markdown('---') + + if choice in MODULES: + module_name = MODULES[choice] + try: + module = importlib.import_module(f"src.apps.pages.programs.{MAIN_DIR}.{module_name}") + func = getattr(module, module_name) + func() + except ModuleNotFoundError: + st.error(f"Module '{module_name}.py' could not be found.") + except AttributeError: + st.error(f"Function '{module_name}' could not be found in '{module_name}.py'.") + except Exception as e: + st.error(f"An error occurred: {e}") + else: + st.info("Star this project on [GitHub](https://github.com/Avdhesh-Varshney/Jarvis), if you like it!", icon='⭐') + +speechToTextProgram() diff --git a/src/utils/functions.py b/src/utils/functions.py index 7b7576bd..52780978 100644 --- a/src/utils/functions.py +++ b/src/utils/functions.py @@ -44,6 +44,7 @@ def logout(): imagePrograms = st.Page("src/apps/pages/programs/imageProgram.py", title="Image Programs", icon=":material/image:") games = st.Page("src/apps/pages/programs/games.py",title="Games",icon=":material/casino:") studyPrograms = st.Page("src/apps/pages/programs/studyProgram.py", title="Study Programs", icon=":material/school:") +speechToTextPrograms = st.Page("src/apps/pages/programs/speechToTextProgram.py",title="speech To Text Programs",icon=":material/casino:") # /apps/pages/adminTools/contributors contributors = st.Page("src/apps/pages/adminTools/contributors.py", title="Contributors", icon=":material/people:") @@ -58,7 +59,7 @@ def load_functions(): "Account": [logout_page], "Automations": [websites, messenger], "Models": [chatBotModels, healthCareModels, objectDetectionModels, recommendationModels], - "Programs": [apiPrograms, games, imagePrograms, simplePrograms, studyPrograms], + "Programs": [apiPrograms, games, imagePrograms, simplePrograms, studyPrograms, speechToTextPrograms], } user = st.session_state['user'].split(',') if user[4] == "Admin" or user[4] == "Super Admin":