kdevoe commited on
Commit
fcd80cc
·
verified ·
1 Parent(s): 9266488

Updating interface. Limiting width of sliders and clear history button

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -83,14 +83,18 @@ with gr.Blocks() as interface:
83
 
84
  # Add the instruction message above the input box
85
  gr.Markdown("**Instructions:** Press `Shift + Enter` to submit, and `Enter` for a new line.")
 
 
 
 
86
 
87
  # Input box for the user
88
  user_input = gr.Textbox(label="Your Input", placeholder="Type your message here...", lines=2, show_label=True)
89
 
90
  # Sliders for temperature, top_p, and top_k
91
- temperature_slider = gr.Slider(0.1, 1.0, step=0.1, value=1.0, label="Temperature")
92
- top_p_slider = gr.Slider(0.0, 1.0, step=0.1, value=1.0, label="Top-p")
93
- top_k_slider = gr.Slider(1, 100, step=1, value=50, label="Top-k")
94
 
95
  # Define the function to update the chat
96
  def update_chat(input_text, chat_history, temperature, top_p, top_k):
@@ -102,10 +106,6 @@ with gr.Blocks() as interface:
102
  inputs=[user_input, chatbot_output, temperature_slider, top_p_slider, top_k_slider],
103
  outputs=[chatbot_output, user_input])
104
 
105
- # Add a clear history button
106
- clear_button = gr.Button("Clear History")
107
- clear_button.click(fn=clear_history, outputs=[chatbot_output])
108
-
109
  # Layout for sliders and chatbot UI
110
  gr.Row([temperature_slider, top_p_slider, top_k_slider])
111
 
 
83
 
84
  # Add the instruction message above the input box
85
  gr.Markdown("**Instructions:** Press `Shift + Enter` to submit, and `Enter` for a new line.")
86
+
87
+ # Add a clear history button
88
+ clear_button = gr.Button("Clear History").style(width=150)
89
+ clear_button.click(fn=clear_history, outputs=[chatbot_output])
90
 
91
  # Input box for the user
92
  user_input = gr.Textbox(label="Your Input", placeholder="Type your message here...", lines=2, show_label=True)
93
 
94
  # Sliders for temperature, top_p, and top_k
95
+ temperature_slider = gr.Slider(0.1, 1.0, step=0.1, value=1.0, label="Temperature").style(width=500)
96
+ top_p_slider = gr.Slider(0.0, 1.0, step=0.1, value=1.0, label="Top-p").style(width=500)
97
+ top_k_slider = gr.Slider(1, 100, step=1, value=50, label="Top-k").style(width=500)
98
 
99
  # Define the function to update the chat
100
  def update_chat(input_text, chat_history, temperature, top_p, top_k):
 
106
  inputs=[user_input, chatbot_output, temperature_slider, top_p_slider, top_k_slider],
107
  outputs=[chatbot_output, user_input])
108
 
 
 
 
 
109
  # Layout for sliders and chatbot UI
110
  gr.Row([temperature_slider, top_p_slider, top_k_slider])
111