Migu3low commited on
Commit
b10b470
·
verified ·
1 Parent(s): bc1a6c4

Update with Gradio documentation (How to Create a Chatbot with Gradio - Additional Inputs)

Browse files
Files changed (1) hide show
  1. app.py +25 -29
app.py CHANGED
@@ -43,42 +43,38 @@ def respond(
43
  For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
44
  """
45
  with gr.Blocks() as demo:
46
- gr.Markdown("Used two ChatBots for testing and comparison of correct answers :+1: ")
47
  with gr.Row() as row:
48
- with gr.Column():
49
  system_prompt = gr.Textbox("You are helpful AI.", label="System Prompt")
50
- slider = gr.Slider(10, 100, render=False)
 
 
 
 
 
 
 
 
 
51
  gr.ChatInterface(
52
- respond,
53
- additional_inputs=[
54
- gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
55
- gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
56
- gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
57
- gr.Slider(
58
- minimum=0.1,
59
- maximum=1.0,
60
- value=0.95,
61
- step=0.05,
62
- label="Top-p (nucleus sampling)",
63
- ),
64
- ],
65
  )
66
 
67
  with gr.Column():
 
 
 
 
 
 
 
 
 
 
 
68
  gr.ChatInterface(
69
- respond,
70
- additional_inputs=[
71
- gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
72
- gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
73
- gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
74
- gr.Slider(
75
- minimum=0.1,
76
- maximum=1.0,
77
- value=0.95,
78
- step=0.05,
79
- label="Top-p (nucleus sampling)",
80
- ),
81
- ],
82
  )
83
 
84
  if __name__ == "__main__":
 
43
  For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
44
  """
45
  with gr.Blocks() as demo:
46
+ gr.Markdown("Used two ChatBots for testing and comparison of correct answers:")
47
  with gr.Row() as row:
48
+ with gr.Column():
49
  system_prompt = gr.Textbox("You are helpful AI.", label="System Prompt")
50
+ slider =
51
+ gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
52
+ gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
53
+ gr.Slider(
54
+ minimum=0.1,
55
+ maximum=1.0,
56
+ value=0.95,
57
+ step=0.05,
58
+ label="Top-p (nucleus sampling)",
59
+ )
60
  gr.ChatInterface(
61
+ respond, additional_inputs=[system_prompt, slider]
 
 
 
 
 
 
 
 
 
 
 
 
62
  )
63
 
64
  with gr.Column():
65
+ system_prompt = gr.Textbox("You are helpful AI.", label="System Prompt")
66
+ slider =
67
+ gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
68
+ gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
69
+ gr.Slider(
70
+ minimum=0.1,
71
+ maximum=1.0,
72
+ value=0.95,
73
+ step=0.05,
74
+ label="Top-p (nucleus sampling)",
75
+ )
76
  gr.ChatInterface(
77
+ respond, additional_inputs=[system_prompt, slider]
 
 
 
 
 
 
 
 
 
 
 
 
78
  )
79
 
80
  if __name__ == "__main__":