File size: 1,943 Bytes
ec74f30
 
df25732
 
3667c7a
 
36bee3f
3667c7a
de9fbbf
81f0a03
 
3667c7a
36bee3f
3667c7a
 
 
1b279d5
81f0a03
 
5b181b6
 
 
70bf9cc
 
81f0a03
00be385
81f0a03
de9fbbf
d1776c8
 
 
 
 
 
de9fbbf
 
 
d1776c8
 
87ae702
81f0a03
 
d1776c8
de9fbbf
d1776c8
 
 
3a5dbe6
1b279d5
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
45
46
47
48
49
50
import os

import gradio as gr

from api.audio import STTManager, TTSManager
from api.llm import LLMManager
from utils.config import Config
from resources.prompts import prompts
from ui.coding import get_problem_solving_ui
from ui.instructions import get_instructions_ui
from utils.params import default_audio_params

config = Config()
llm = LLMManager(config, prompts)
tts = TTSManager(config)
stt = STTManager(config)

default_audio_params["streaming"] = stt.streaming

if os.getenv("SILENT", False):
    tts.read_last_message = lambda x: None

# Interface

with gr.Blocks(title="AI Interviewer") as demo:
    audio_output = gr.Audio(label="Play audio", autoplay=True, visible=os.environ.get("DEBUG", False), streaming=tts.streaming)
    instructions_tab = get_instructions_ui(llm, tts, stt, default_audio_params)
    coding_tab = get_problem_solving_ui(llm, tts, stt, default_audio_params, audio_output, name="Coding", interview_type="coding")
    ml_design_tab = get_problem_solving_ui(
        llm, tts, stt, default_audio_params, audio_output, name="ML Design (Beta)", interview_type="ml_design"
    )
    ml_theory_tab = get_problem_solving_ui(
        llm, tts, stt, default_audio_params, audio_output, name="ML Theory (Beta)", interview_type="ml_theory"
    )
    system_design_tab = get_problem_solving_ui(
        llm, tts, stt, default_audio_params, audio_output, name="System Design (Beta)", interview_type="system_design"
    )
    math_design_tab = get_problem_solving_ui(llm, tts, stt, default_audio_params, audio_output, name="Math (Beta)", interview_type="math")
    sql_design_tab = get_problem_solving_ui(llm, tts, stt, default_audio_params, audio_output, name="SQL (Beta)", interview_type="sql")

    instructions_tab.render()
    coding_tab.render()
    ml_design_tab.render()
    system_design_tab.render()
    ml_theory_tab.render()
    math_design_tab.render()
    sql_design_tab.render()

demo.launch(show_api=False)