Rabbiaaa commited on
Commit
47b4748
Β·
verified Β·
1 Parent(s): d42cc75

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +86 -0
app.py ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from app_functions import Get_DialoGPT_Response, Get_DistilGPT_Response, Get_MedGPT_Response
3
+
4
+ # Custom CSS for styling (optional)
5
+ custom_css = """
6
+ body {
7
+ background-color: #121212;
8
+ color: #E0E0E0;
9
+ font-family: 'Poppins', sans-serif;
10
+ }
11
+ .gradio-container {
12
+ width: 70%;
13
+ margin: 0 auto;
14
+ padding: 20px;
15
+ }
16
+ h1 {
17
+ color: #FF6347;
18
+ font-size: 50px;
19
+ text-align: center;
20
+ font-weight: bold;
21
+ }
22
+ h3 {
23
+ color: #FF6347;
24
+ text-align: center;
25
+ }
26
+ textarea, input, select {
27
+ background-color: #1E1E2F;
28
+ color: #E0E0E0;
29
+ border: 1px solid #3D3D5C;
30
+ border-radius: 6px;
31
+ padding: 10px;
32
+ font-size: 14px;
33
+ }
34
+ button {
35
+ background-color: #007BFF;
36
+ color: white;
37
+ font-size: 16px;
38
+ font-weight: bold;
39
+ padding: 10px;
40
+ border-radius: 6px;
41
+ border: none;
42
+ cursor: pointer;
43
+ transition: all 0.3s;
44
+ width: 50%;
45
+ margin: 0 auto;
46
+ }
47
+ button:hover {
48
+ background-color: #0056b3;
49
+ }
50
+ .response-box {
51
+ background-color: #1E1E2F;
52
+ padding: 15px;
53
+ border-radius: 6px;
54
+ color: #E0E0E0;
55
+ font-size: 16px;
56
+ min-height: 100px;
57
+ text-align: left;
58
+ }
59
+ """
60
+
61
+ # Build Gradio interface
62
+ with gr.Blocks(css=custom_css) as interface:
63
+ gr.Markdown("<h1>Healthwise AI Assistant πŸš‘</h1>")
64
+ gr.Markdown("<h3 style='color: #FF6347;'>Get accurate health-related advice tailored for your needs 😊</h3>")
65
+
66
+ with gr.Row():
67
+ with gr.Column(scale=1):
68
+ gr.Markdown("<h3>Your Query</h3>")
69
+ input_text = gr.Textbox(label="Question", placeholder="Type your health-related question...", lines=2)
70
+ no_words = gr.Textbox(label="Max No. of Words", placeholder="Enter max words for the response (e.g., 100)")
71
+ with gr.Column(scale=1):
72
+ gr.Markdown("<h3>Preferences</h3>")
73
+ user_type = gr.Radio(label="Answer For", choices=["Professional", "Practitioner", "General"], value="General")
74
+ model_type = gr.Radio(label="Model Type", choices=["DialoGPT", "DistilGPT", "MedGPT"], value="DialoGPT")
75
+
76
+ with gr.Row():
77
+ submit_button = gr.Button("Generate Response")
78
+
79
+ with gr.Row():
80
+ gr.Markdown("<h3>AI Assistant's Advice πŸ‘‡</h3>")
81
+ with gr.Row():
82
+ response = gr.HTML("<div class='response-box'>The AI's response will appear here...</div>")
83
+
84
+ submit_button.click(generate_response, inputs=[input_text, no_words, user_type, model_type], outputs=response)
85
+
86
+ interface.launch()