mmesa-gitex / app.py
vitorcalvi's picture
12 Oct Gitex 2024
b20a621
raw
history blame
1.23 kB
# app.py
import gradio as gr
from tabs.speech_stress_analysis import create_voice_stress_tab
from tabs.speech_emotion_recognition import create_emotion_recognition_tab
from tabs.FACS_analysis import create_facs_analysis_tab
# Import the UI components
from ui_components import CUSTOM_CSS, HEADER_HTML, DISCLAIMER_HTML
# Define the tab structure
TAB_STRUCTURE = [
("Visual Analysis", [
("FACS for Stress, Anxiety, Depression", create_facs_analysis_tab),
]),
("Speech Analysis", [
("Speech Stress", create_voice_stress_tab),
("Speech Emotion", create_emotion_recognition_tab),
])
]
def create_demo():
with gr.Blocks(css=CUSTOM_CSS) as demo:
gr.Markdown(HEADER_HTML)
with gr.Tabs(elem_classes=["main-tab"]):
for main_tab, sub_tabs in TAB_STRUCTURE:
with gr.Tab(main_tab):
with gr.Tabs():
for sub_tab, create_fn in sub_tabs:
with gr.Tab(sub_tab):
create_fn()
gr.HTML(DISCLAIMER_HTML)
return demo
# Create the demo instance
demo = create_demo()
if __name__ == "__main__":
demo.queue(api_open=True).launch(share=False)