Poonawala commited on
Commit
d9825df
·
verified ·
1 Parent(s): aacf3f8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -20
app.py CHANGED
@@ -63,35 +63,36 @@ with gr.Blocks(css=css) as demo:
63
  gr.Markdown("<h1 style='text-align: center;'>Health Assistant GPT</h1>")
64
  gr.Markdown("<h3 style='text-align: center;'>What do you want to know about health and wellness?</h3>")
65
 
66
- # Sidebar
67
- with gr.Sidebar():
68
- gr.Markdown("### Settings")
69
- system_message = gr.Textbox(
70
- value="You are a virtual health assistant designed to provide accurate and reliable information related to health, wellness, and medical topics. Your primary goal is to assist users with their health-related queries, offer general guidance, and suggest when to consult a licensed medical professional. If a user asks a question that is unrelated to health, wellness, or medical topics, respond politely but firmly.",
71
- label="System message",
72
- visible=False
73
- )
74
- max_tokens = gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens", visible=False)
75
- temperature = gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature", visible=False)
76
- top_p = gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-p (nucleus sampling)", visible=False)
77
-
78
- # Main content
79
  with gr.Row():
 
 
 
 
 
 
 
 
 
 
 
 
 
80
  with gr.Column(scale=7):
81
  gr.Markdown("### Ask a health-related question:")
82
  search_input = gr.Textbox(label="Search Input", placeholder="Type your health-related question here...", lines=1)
83
  submit_button = gr.Button("Generate Response")
84
  output = gr.Markdown()
85
 
86
- with gr.Column(scale=3):
87
  gr.Markdown("### Upload a relevant file (Optional):")
88
  uploaded_file = gr.File(label="Upload PDF")
89
 
90
- # Button click action to trigger response generation
91
- submit_button.click(
92
- fn=respond,
93
- inputs=[search_input, [], system_message, max_tokens, temperature, top_p], # Empty history for fresh chat
94
- outputs=output
95
- )
96
 
97
  demo.launch()
 
63
  gr.Markdown("<h1 style='text-align: center;'>Health Assistant GPT</h1>")
64
  gr.Markdown("<h3 style='text-align: center;'>What do you want to know about health and wellness?</h3>")
65
 
66
+ # Create layout with two columns
 
 
 
 
 
 
 
 
 
 
 
 
67
  with gr.Row():
68
+ # Sidebar content
69
+ with gr.Column(scale=3):
70
+ gr.Markdown("### Settings")
71
+ system_message = gr.Textbox(
72
+ value="You are a virtual health assistant designed to provide accurate and reliable information related to health, wellness, and medical topics. Your primary goal is to assist users with their health-related queries, offer general guidance, and suggest when to consult a licensed medical professional. If a user asks a question that is unrelated to health, wellness, or medical topics, respond politely but firmly.",
73
+ label="System message",
74
+ visible=False
75
+ )
76
+ max_tokens = gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens", visible=False)
77
+ temperature = gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature", visible=False)
78
+ top_p = gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-p (nucleus sampling)", visible=False)
79
+
80
+ # Main content (question input and response display)
81
  with gr.Column(scale=7):
82
  gr.Markdown("### Ask a health-related question:")
83
  search_input = gr.Textbox(label="Search Input", placeholder="Type your health-related question here...", lines=1)
84
  submit_button = gr.Button("Generate Response")
85
  output = gr.Markdown()
86
 
87
+ # File upload area
88
  gr.Markdown("### Upload a relevant file (Optional):")
89
  uploaded_file = gr.File(label="Upload PDF")
90
 
91
+ # Button click action to trigger response generation
92
+ submit_button.click(
93
+ fn=respond,
94
+ inputs=[search_input, [], system_message, max_tokens, temperature, top_p], # Empty history for fresh chat
95
+ outputs=output
96
+ )
97
 
98
  demo.launch()