Poonawala commited on
Commit
d856f89
·
verified ·
1 Parent(s): 487cbd7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -14
app.py CHANGED
@@ -63,23 +63,29 @@ body {
63
  color: white !important; /* Slider labels in white */
64
  }
65
  """
66
- def on_button_click(model_name):
67
- return f"You selected {model_name}"
68
  """
69
  For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
70
  """
71
- demo = gr.ChatInterface(
72
- respond,
73
- additional_inputs=[
74
- gr.Textbox(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 with: 'I'm sorry, I can't help with that because I am a virtual health assistant designed to assist with health-related needs. Please let me know if you have any health-related questions.' Never provide advice or information outside the health domain. Remain professional, empathetic, and clear in all responses. Always prioritize user safety and encourage professional medical consultation for critical or complex health concerns.", label="System message", visible=False),
75
- gr.Button("Chatgpt").click(on_button_click, inputs="Chatgpt", outputs="text"),
76
- gr.Button("Llama").click(on_button_click, inputs="Llama", outputs="text"),
77
- gr.Button("Claude").click(on_button_click, inputs="Claude", outputs="text"),
78
- gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens", visible=False),
79
- gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature", visible=False),
80
- gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-p (nucleus sampling)", visible=False),
81
- ],
82
- css=css, # Pass the custom CSS here
 
 
 
 
 
 
 
83
  )
84
 
85
 
 
63
  color: white !important; /* Slider labels in white */
64
  }
65
  """
66
+
 
67
  """
68
  For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
69
  """
70
+ with gr.Blocks() as demo:
71
+ # Add all your components here, including buttons
72
+ gr.Textbox(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 with: 'I'm sorry, I can't help with that because I am a virtual health assistant designed to assist with health-related needs. Please let me know if you have any health-related questions.' Never provide advice or information outside the health domain. Remain professional, empathetic, and clear in all responses. Always prioritize user safety and encourage professional medical consultation for critical or complex health concerns.", label="System message", visible=False)
73
+
74
+ # Create buttons with event handlers
75
+ gr.Button("Chatgpt").click(on_button_click, inputs="Chatgpt", outputs="text")
76
+ gr.Button("Llama").click(on_button_click, inputs="Llama", outputs="text")
77
+ gr.Button("Claude").click(on_button_click, inputs="Claude", outputs="text")
78
+
79
+ gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens", visible=False)
80
+ gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature", visible=False)
81
+ gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-p (nucleus sampling)", visible=False)
82
+
83
+ # Optional: customize your layout with CSS if needed
84
+ css = """
85
+ /* Your custom CSS here */
86
+ """
87
+
88
+ demo.css = css, # Pass the custom CSS here
89
  )
90
 
91