Spaces:
Sleeping
Sleeping
import gradio as gr | |
from tabs.heart_rate_variability import create_hrv_tab | |
from tabs.blink_detection import create_blink_tab | |
from tabs.gaze_estimation import create_gaze_estimation_tab | |
from tabs.speech_stress_analysis import create_voice_stress_tab | |
from tabs.head_posture_detection import create_head_posture_tab | |
from tabs.face_expressions import create_face_expressions_tab | |
from tabs.speech_emotion_recognition import create_emotion_recognition_tab | |
from tabs.sleep_quality import create_sleep_quality_tab | |
from tabs.sentiment_analysis import create_sentiment_tab | |
from tabs.emotion_analysis import create_emotion_tab | |
from tabs.body_movement_analysis import create_body_movement_tab | |
from tabs.posture_analysis import create_posture_analysis_tab | |
from tabs.skin_analysis import create_skin_conductance_tab | |
from tabs.FACS_analysis_sad import create_facs_analysis_sad_tab | |
from tabs.roberta_chatbot import create_roberta_chatbot_tab | |
# Import the UI components | |
from ui_components import CUSTOM_CSS, HEADER_HTML, DISCLAIMER_HTML | |
TAB_STRUCTURE = [ | |
("Visual Analysis", [ | |
# ("Emotional Face Expressions", create_face_expressions_tab), | |
("FACS for Stress, Anxiety, Depression", create_facs_analysis_sad_tab) | |
# ("Gaze Estimation", create_gaze_estimation_tab), | |
# ("Head Posture", create_head_posture_tab), | |
# ("Blink Rate", create_blink_tab), | |
# ("Sleep Quality", create_sleep_quality_tab), | |
# ("Heart Rate Variability", create_hrv_tab), | |
# ("Body Movement", create_body_movement_tab), | |
# ("Posture", create_posture_analysis_tab), | |
# ("Skin", create_skin_conductance_tab) | |
]), | |
# ("Speech Analysis", [ | |
# ("Speech Stress", create_voice_stress_tab), | |
# ("Speech Emotion", create_emotion_recognition_tab) | |
# ]), | |
# ("Text Analysis", [ | |
# ("Sentiment", create_sentiment_tab), | |
# ("Emotion", create_emotion_tab), | |
# ("Roberta Mental Health Chatbot", create_roberta_chatbot_tab) | |
# ]), | |
# ("Brain Analysis (coming soon)", [ | |
# ]) | |
] | |
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) |