File size: 1,594 Bytes
52f4b0f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
51
52
53
54
55
56
57
58
59
import gradio as gr
from agent import agent_respond

def agent_interface(user_question, debug_mode=True):
    return agent_respond(user_question)

custom_css = """
.gradio-container {
    max-width: 1400px !important;
    margin-left: auto;
    margin-right: auto;
}
.output-box {
    min-height: 500px !important;
    font-size: 16px !important;
}
.input-box {
    min-height: 150px !important;
    font-size: 16px !important;
}
"""

with gr.Blocks(css=custom_css, theme=gr.themes.Base()) as demo:
    gr.Markdown("# Healthcare Tool-Using AI Agent")
    gr.Markdown("An agent that uses document retrieval, live web search, and calculation to answer clinical healthcare questions.")
    
    with gr.Row():
        with gr.Column(scale=1):
            user_question = gr.Textbox(
                lines=4, 
                placeholder="Ask a healthcare question...", 
                elem_classes="input-box",
                label="Question"
            )
            debug_mode = gr.Checkbox(label="Debug Mode", value=True)
            submit_btn = gr.Button("Submit")
            clear_btn = gr.Button("Clear")
        
        with gr.Column(scale=2):
            output = gr.Textbox(
                lines=30, 
                elem_classes="output-box",
                label="Response"
            )
    
    submit_btn.click(
        fn=agent_interface,
        inputs=[user_question, debug_mode],
        outputs=output
    )
    
    clear_btn.click(
        fn=lambda: "",
        inputs=None,
        outputs=[user_question, output]
    )

if __name__ == "__main__":
    demo.launch()