amirgame197 commited on
Commit
0878eec
·
verified ·
1 Parent(s): 9cff5d9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -101,6 +101,9 @@ def check_rand(inp, val):
101
  else:
102
  return gr.Slider(label="Seed", minimum=1, maximum=1111111111111111, value=int(val))
103
 
 
 
 
104
  with gr.Blocks() as app:
105
  memory = gr.State()
106
  chat_b = gr.Chatbot(height=500)
@@ -133,8 +136,8 @@ with gr.Blocks() as app:
133
  client_choice.change(load_models, client_choice, [chat_b])
134
  app.load(load_models, client_choice, [chat_b])
135
 
136
- chat_sub = inp.submit(check_rand, [rand, seed], seed).then(chat_inf, [sys_inp, inp, chat_b, memory, client_choice, seed, temp, tokens, top_p, rep_p, chat_mem, custom_prompt, translate_to_persian_checkbox.value], [chat_b, memory])
137
- go = btn.click(check_rand, [rand, seed], seed).then(chat_inf, [sys_inp, inp, chat_b, memory, client_choice, seed, temp, tokens, top_p, rep_p, chat_mem, custom_prompt, translate_to_persian_checkbox.value], [chat_b, memory])
138
 
139
  clear_btn.click(clear_fn, None, [inp, sys_inp, chat_b, memory])
140
  app.queue(default_concurrency_limit=10).launch()
 
101
  else:
102
  return gr.Slider(label="Seed", minimum=1, maximum=1111111111111111, value=int(val))
103
 
104
+ def chat_wrapper(sys_inp, inp, chat_b, memory, client_choice, seed, temp, tokens, top_p, rep_p, chat_mem, custom_prompt, translate_to_persian_checkbox):
105
+ return chat_inf(sys_inp, inp, chat_b, memory, client_choice, seed, temp, tokens, top_p, rep_p, chat_mem, custom_prompt, translate_to_persian_checkbox)
106
+
107
  with gr.Blocks() as app:
108
  memory = gr.State()
109
  chat_b = gr.Chatbot(height=500)
 
136
  client_choice.change(load_models, client_choice, [chat_b])
137
  app.load(load_models, client_choice, [chat_b])
138
 
139
+ chat_sub = inp.submit(check_rand, [rand, seed], seed).then(chat_wrapper, [sys_inp, inp, chat_b, memory, client_choice, seed, temp, tokens, top_p, rep_p, chat_mem, custom_prompt, translate_to_persian_checkbox]).then(display=chat_b, state=memory)
140
+ go = btn.click(check_rand, [rand, seed], seed).then(chat_wrapper, [sys_inp, inp, chat_b, memory, client_choice, seed, temp, tokens, top_p, rep_p, chat_mem, custom_prompt, translate_to_persian_checkbox]).then(display=chat_b, state=memory)
141
 
142
  clear_btn.click(clear_fn, None, [inp, sys_inp, chat_b, memory])
143
  app.queue(default_concurrency_limit=10).launch()