File size: 1,936 Bytes
f8bf7df
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5698eb5
f8bf7df
 
 
 
5698eb5
f8bf7df
 
 
5698eb5
f8bf7df
 
 
 
 
 
 
 
 
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
import gradio as gr
from utils.chatbot import ChatBot


# Define CSS styles for a clean and modern UI
custom_css = """
body {
    background: linear-gradient(to right, #004aad, #00a2ff);
    color: white;
    font-family: 'Poppins', sans-serif;
}

h1 {
    text-align: center;
    font-size: 36px;
    font-weight: bold;
    color: white;
    text-shadow: 2px 2px 10px rgba(255, 255, 255, 0.5);
    margin-bottom: 20px;
}

#chatbot {
    background: #dfe9ff;
    border-radius: 15px;
    padding: 15px;
    color: #003366;
    font-size: 16px;
    min-height: 500px;
    border: 2px solid #003366;
    box-shadow: 0 0 10px rgba(0, 162, 255, 0.6);
}

input {
    border-radius: 8px;
    padding: 10px;
    font-size: 16px;
    border: 2px solid #007bff;
    background-color: #eef6ff;
    color: #003366;
}

button {
    background-color: #003366;
    color: white;
    border-radius: 8px;
    padding: 12px 18px;
    border: none;
    cursor: pointer;
    font-weight: bold;
    transition: 0.3s ease-in-out;
    box-shadow: 0px 4px 8px rgba(255, 255, 255, 0.2);
}

button:hover {
    background-color: #00a2ff;
    box-shadow: 0px 4px 12px rgba(255, 255, 255, 0.4);
}

.gradio-container {
    max-width: 900px;
    margin: auto;
    padding: 20px;
    text-align: center;
}
"""

# Define the chatbot UI with only input and response
with gr.Blocks(css=custom_css) as demo:
    gr.Markdown("<h1>🚑 First Aid Tutor</h1>")

    chatbot = gr.Chatbot([], elem_id="chatbot", bubble_full_width=False, height=500, type="messages")

    user_input = gr.Textbox(
        label="💬 Ask a First Aid Question:",
        placeholder="Type your question here...",
    )

    submit_button = gr.Button("🚀 Get First Aid Advice")

    submit_button.click(
        fn=ChatBot.respond,
        inputs=[chatbot, user_input],  # Only chatbot & input
        outputs=[user_input, chatbot],
    )

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