kshahnathwani commited on
Commit
53a4d7c
·
verified ·
1 Parent(s): ba1881f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -21
app.py CHANGED
@@ -55,27 +55,22 @@ def clear_chat():
55
  """
56
  For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
57
  """
58
- with gr.Blocks() as demo:
59
- chatbot = gr.Chatbot(label="Chat")
60
- system_message = gr.Textbox(value="You are a friendly Chatbot.", label="System message")
61
- max_tokens = gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens")
62
- temperature = gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature")
63
- top_p = gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-p (nucleus sampling)")
64
- personality = gr.Dropdown(choices=["friendly", "professional", "humorous", "serious"], value="friendly", label="Personality")
65
- message = gr.Textbox(placeholder="Enter your message here...", label="Message")
66
- submit_button = gr.Button("Send Message")
67
- clear_button = gr.Button("Clear Chat")
68
-
69
- submit_button.click(
70
- respond,
71
- inputs=[message, chatbot, system_message, max_tokens, temperature, top_p, personality], # Pass personality as input
72
- outputs=[chatbot]
73
- )
74
-
75
- clear_button.click(
76
- clear_chat,
77
- outputs=[message, chatbot]
78
- )
79
 
80
 
81
  if __name__ == "__main__":
 
55
  """
56
  For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
57
  """
58
+ demo = gr.ChatInterface(
59
+ respond,
60
+ additional_inputs=[
61
+ gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
62
+ gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
63
+ gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
64
+ gr.Slider(
65
+ minimum=0.1,
66
+ maximum=1.0,
67
+ value=0.95,
68
+ step=0.05,
69
+ label="Top-p (nucleus sampling)",
70
+ ),
71
+ gr.Dropdown(choices=["friendly", "professional", "humorous", "serious"], value="friendly", label="Personality"),
72
+ ]
73
+ )
 
 
 
 
 
74
 
75
 
76
  if __name__ == "__main__":