chansung commited on
Commit
deb765f
1 Parent(s): 1515bf0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -9
app.py CHANGED
@@ -94,8 +94,8 @@ def fill_up_placeholders(txt):
94
 
95
  async def rollback_last(
96
  idx, local_data, chat_state,
97
- global_context, res_temp, res_topk, res_rpen, res_mnts, res_sample, ctx_num_lconv,
98
- internet_option, serper_api_key, palm_if
99
  ):
100
  internet_option = True if internet_option == "on" else False
101
 
@@ -152,8 +152,8 @@ def reset_chat(idx, ld, state, palm_if):
152
 
153
  async def chat_stream(
154
  idx, local_data, instruction_txtbox, chat_state,
155
- global_context, res_temp, res_topk, res_topp,
156
- internet_option, serper_api_key, palm_if
157
  ):
158
  internet_option = True if internet_option == "on" else False
159
 
@@ -349,7 +349,12 @@ with gr.Blocks(css=MODEL_SELECTION_CSS, theme='gradio/soft') as demo:
349
  res_temp = gr.Slider(0.0, 2.0, 1.0, step=0.1, label="temp", interactive=True)
350
  res_topk = gr.Slider(20, 1000, 50, step=1, label="top_k", interactive=True)
351
  res_topp = gr.Slider(0.0, 1.0, 0.9, step=0.1, label="top_p", interactive=True)
352
-
 
 
 
 
 
353
  gr.Markdown(
354
  "***NOTE:*** If you are subscribing [PRO](https://huggingface.co/pricing#pro), you can simply duplicate this space and use your "
355
  "Hugging Face Access Token to run the same application. Just add `HF_TOKEN` secret with the Token value accorindg to [this guide]"
@@ -373,8 +378,8 @@ with gr.Blocks(css=MODEL_SELECTION_CSS, theme='gradio/soft') as demo:
373
  ).then(
374
  chat_stream,
375
  [idx, local_data, instruction_txtbox, chat_state,
376
- global_context, res_temp, res_topk, res_topp,
377
- internet_option, serper_api_key, palm_if],
378
  [instruction_txtbox, context_inspector, chatbot, local_data, regenerate, internet_option]
379
  ).then(
380
  None, local_data, None,
@@ -405,8 +410,8 @@ with gr.Blocks(css=MODEL_SELECTION_CSS, theme='gradio/soft') as demo:
405
  regen_event = regenerate.click(
406
  rollback_last,
407
  [idx, local_data, chat_state,
408
- global_context, res_temp, res_topk, res_topp,
409
- internet_option, serper_api_key, palm_if],
410
  [context_inspector, chatbot, local_data, regenerate, internet_option]
411
  ).then(
412
  None, local_data, None,
 
94
 
95
  async def rollback_last(
96
  idx, local_data, chat_state,
97
+ global_context, res_temp, res_topk, res_toppo, ctx_num_lconv
98
+ internet_option, serper_api_key
99
  ):
100
  internet_option = True if internet_option == "on" else False
101
 
 
152
 
153
  async def chat_stream(
154
  idx, local_data, instruction_txtbox, chat_state,
155
+ global_context, res_temp, res_topk, res_topp, ctx_num_lconv
156
+ internet_option, serper_api_key,
157
  ):
158
  internet_option = True if internet_option == "on" else False
159
 
 
349
  res_temp = gr.Slider(0.0, 2.0, 1.0, step=0.1, label="temp", interactive=True)
350
  res_topk = gr.Slider(20, 1000, 50, step=1, label="top_k", interactive=True)
351
  res_topp = gr.Slider(0.0, 1.0, 0.9, step=0.1, label="top_p", interactive=True)
352
+
353
+ with gr.Column():
354
+ gr.Markdown("#### Context managements")
355
+ with gr.Row():
356
+ ctx_num_lconv = gr.Slider(2, 10, 3, step=1, label="number of recent talks to keep", interactive=True)
357
+
358
  gr.Markdown(
359
  "***NOTE:*** If you are subscribing [PRO](https://huggingface.co/pricing#pro), you can simply duplicate this space and use your "
360
  "Hugging Face Access Token to run the same application. Just add `HF_TOKEN` secret with the Token value accorindg to [this guide]"
 
378
  ).then(
379
  chat_stream,
380
  [idx, local_data, instruction_txtbox, chat_state,
381
+ global_context, res_temp, res_topk, res_topp, ctx_num_lconv
382
+ internet_option, serper_api_key],
383
  [instruction_txtbox, context_inspector, chatbot, local_data, regenerate, internet_option]
384
  ).then(
385
  None, local_data, None,
 
410
  regen_event = regenerate.click(
411
  rollback_last,
412
  [idx, local_data, chat_state,
413
+ global_context, res_temp, res_topk, res_topp, ctx_num_lconv
414
+ internet_option, serper_api_key],
415
  [context_inspector, chatbot, local_data, regenerate, internet_option]
416
  ).then(
417
  None, local_data, None,