Poonawala commited on
Commit
ca99935
·
verified ·
1 Parent(s): 439f105

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -12
app.py CHANGED
@@ -97,20 +97,20 @@ body {
97
 
98
  # Interface using Blocks context
99
  with gr.Blocks() as demo:
100
- # Add your components including buttons
101
- gr.Textbox(value="You are a virtual health assistant...", label="System message", visible=False)
102
-
 
 
 
 
 
103
  # Buttons to select the model
104
- gr.Button("Chatgpt").click(on_button_click, inputs=["Chatgpt", "textbox", "history", "system_message", "max_tokens", "temperature", "top_p"], outputs="text")
105
- gr.Button("Llama").click(on_button_click, inputs=["Llama", "textbox", "history", "system_message", "max_tokens", "temperature", "top_p"], outputs="text")
106
- gr.Button("Claude").click(on_button_click, inputs=["Claude", "textbox", "history", "system_message", "max_tokens", "temperature", "top_p"], outputs="text")
107
-
108
- # Sliders for max tokens, temperature, and top-p
109
- gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens", visible=False)
110
- gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature", visible=False)
111
- gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-p (nucleus sampling)", visible=False)
112
 
113
- # Apply the custom CSS for styling
114
  demo.css = css
115
 
116
  # Launch the app
 
97
 
98
  # Interface using Blocks context
99
  with gr.Blocks() as demo:
100
+ # Add all your components here, including buttons
101
+ system_message = gr.Textbox(value="You are a virtual health assistant...", label="System message", visible=False)
102
+ message_input = gr.Textbox(label="User message")
103
+ history = gr.State([]) # Keep the history of interactions
104
+ max_tokens_slider = gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens")
105
+ temperature_slider = gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature")
106
+ top_p_slider = gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-p (nucleus sampling)")
107
+
108
  # Buttons to select the model
109
+ gr.Button("Chatgpt").click(on_button_click, inputs=[message_input, history, system_message, max_tokens_slider, temperature_slider, top_p_slider], outputs="text")
110
+ gr.Button("Llama").click(on_button_click, inputs=[message_input, history, system_message, max_tokens_slider, temperature_slider, top_p_slider], outputs="text")
111
+ gr.Button("Claude").click(on_button_click, inputs=[message_input, history, system_message, max_tokens_slider, temperature_slider, top_p_slider], outputs="text")
 
 
 
 
 
112
 
113
+ # Optional: customize your layout with CSS if needed
114
  demo.css = css
115
 
116
  # Launch the app