File size: 1,230 Bytes
4aa23ee
78c30f0
 
4aa23ee
 
dbc8e33
 
056938d
dbc8e33
 
 
 
 
78c30f0
797d38d
4aa23ee
78c30f0
dbc8e33
4aa23ee
7aaa8a4
 
4aa23ee
7aaa8a4
4aa23ee
797d38d
 
 
dbc8e33
797d38d
 
 
 
 
 
c5cdcf3
797d38d
4aa23ee
78c30f0
4aa23ee
dbc8e33
c5cdcf3
 
 
78c30f0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# =======================================
# ENTRY POINT - HUGGINGFACE SPACES
# Vocal Articulation Assessment v2.0
# =======================================

import os
import logging
import gradio as gr

# Suppress Starlette warnings
logging.getLogger("starlette").setLevel(logging.ERROR)
logging.getLogger("uvicorn").setLevel(logging.ERROR)

from app.interface import create_interface, initialize_model
from app.api_gradio import create_api_interface

if __name__ == '__main__':
    print('Starting Vocal Articulation Assessment System v2.0...')
    
    # Initialize model once at startup (prevents double-run issue)
    print('Preloading Whisper model...')
    initialize_model()
    print('Model preloaded successfully!')
    
    # Create UI and API interfaces
    ui_demo = create_interface()
    api_demo = create_api_interface()
    
    # Combine both interfaces with tabs
    demo = gr.TabbedInterface(
        [ui_demo, api_demo],
        ["🎤 Assessment UI", "📡 JSON API"],
        title="Vocal Articulation System v2.0"
    )
    
    # Launch
    demo.launch(
        server_name='0.0.0.0',
        server_port=7860,
        share=False,
        show_error=False,
        max_threads=40,
        quiet=True
    )