Alyafeai commited on
Commit
c7ae4ed
1 Parent(s): a49732a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -2
app.py CHANGED
@@ -66,6 +66,15 @@ def chat_accordion():
66
  interactive=True,
67
  label="p (nucleus sampling)",
68
  )
 
 
 
 
 
 
 
 
 
69
 
70
  session_id = gr.Textbox(
71
  value=uuid4,
@@ -105,7 +114,7 @@ def chat_accordion():
105
  visible=False,
106
  )
107
 
108
- return temperature, top_p, instructions, user_name, bot_name, session_id
109
 
110
 
111
  def format_chat_prompt(
@@ -162,6 +171,7 @@ def chat_tab():
162
  temperature: float,
163
  top_p: float,
164
  session_id: str,
 
165
  ):
166
  prompt = format_chat_prompt(message, history, instructions, user_name, bot_name)
167
  payload = {
@@ -169,7 +179,7 @@ def chat_tab():
169
  "data": {
170
  "inputs": prompt,
171
  "parameters": {
172
- "max_new_tokens": 512,
173
  "do_sample": True,
174
  "top_p": top_p,
175
  "stop": ["User:"],
@@ -237,6 +247,7 @@ def chat_tab():
237
  user_name,
238
  bot_name,
239
  session_id,
 
240
  ) = chat_accordion()
241
 
242
  with gr.Column():
@@ -271,6 +282,7 @@ def chat_tab():
271
  temperature,
272
  top_p,
273
  session_id,
 
274
  ],
275
  submit_btn="Send",
276
  stop_btn="Stop",
 
66
  interactive=True,
67
  label="p (nucleus sampling)",
68
  )
69
+
70
+ max_tokens = gr.Slider(
71
+ minimum=64,
72
+ maximum=1024,
73
+ value=64,
74
+ step=1,
75
+ interactive=True,
76
+ label="Max Tokens",
77
+ )
78
 
79
  session_id = gr.Textbox(
80
  value=uuid4,
 
114
  visible=False,
115
  )
116
 
117
+ return temperature, top_p, instructions, user_name, bot_name, session_id, max_tokens
118
 
119
 
120
  def format_chat_prompt(
 
171
  temperature: float,
172
  top_p: float,
173
  session_id: str,
174
+ max_tokens: int
175
  ):
176
  prompt = format_chat_prompt(message, history, instructions, user_name, bot_name)
177
  payload = {
 
179
  "data": {
180
  "inputs": prompt,
181
  "parameters": {
182
+ "max_new_tokens": max_tokens,
183
  "do_sample": True,
184
  "top_p": top_p,
185
  "stop": ["User:"],
 
247
  user_name,
248
  bot_name,
249
  session_id,
250
+ max_tokens
251
  ) = chat_accordion()
252
 
253
  with gr.Column():
 
282
  temperature,
283
  top_p,
284
  session_id,
285
+ max_tokens
286
  ],
287
  submit_btn="Send",
288
  stop_btn="Stop",