youzhang commited on
Commit
bcb267e
·
verified ·
1 Parent(s): 84a4b4f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -1
app.py CHANGED
@@ -145,13 +145,21 @@ with gr.Blocks(css="footer{display:none !important}") as demo:
145
  temperature = gr.Slider(0, 1, value=0.7, label="Temperature")
146
  top_p = gr.Slider(0, 1, value=0.95, label="Top P")
147
  state = gr.State([])
148
-
149
  def wrapped_predict(message, history, model, max_tokens, temperature, top_p):
150
  full_response = ""
151
  for chunk in predict(message, history, subject, model, max_tokens, temperature, top_p):
152
  full_response = chunk
153
  history.append([message, full_response])
154
  return history, ""
 
 
 
 
 
 
 
 
155
 
156
  user_input.submit(
157
  wrapped_predict,
 
145
  temperature = gr.Slider(0, 1, value=0.7, label="Temperature")
146
  top_p = gr.Slider(0, 1, value=0.95, label="Top P")
147
  state = gr.State([])
148
+ '''
149
  def wrapped_predict(message, history, model, max_tokens, temperature, top_p):
150
  full_response = ""
151
  for chunk in predict(message, history, subject, model, max_tokens, temperature, top_p):
152
  full_response = chunk
153
  history.append([message, full_response])
154
  return history, ""
155
+ '''
156
+ # 👇 Use subject=subject to freeze its value
157
+ def wrapped_predict(message, history, model, max_tokens, temperature, top_p, subject=subject):
158
+ full_response = ""
159
+ for chunk in predict(message, history, subject, model, max_tokens, temperature, top_p):
160
+ full_response = chunk
161
+ history.append([message, full_response])
162
+ return history, ""
163
 
164
  user_input.submit(
165
  wrapped_predict,