Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -188,7 +188,7 @@ with gr.Blocks(css=MODEL_SELECTION_CSS, theme='gradio/soft') as demo:
|
|
| 188 |
|
| 189 |
with gr.Row(elem_id="container"):
|
| 190 |
with gr.Column():
|
| 191 |
-
gr.Markdown("""This application is built and provided for anyone who wants to try out open source Large Language Models for free. All the provided models are pre-downloaded and pre-loaded to maximize your experience. This application is hosted on
|
| 192 |
|
| 193 |
From this page, choose a model that you would like to try out. By selecting a model, you will see more detailed description of the model in a separate page. Also note that this page will appear whenever you refresh your browser tab. """)
|
| 194 |
with gr.Row(elem_classes=["sub-container"]):
|
|
@@ -453,27 +453,10 @@ Lastly, there is a hidden panel on the top right corner, and it will appear when
|
|
| 453 |
instruction_txtbox.submit(
|
| 454 |
lambda: [
|
| 455 |
gr.update(visible=False),
|
| 456 |
-
gr.update(
|
| 457 |
],
|
| 458 |
None,
|
| 459 |
-
[example_block,
|
| 460 |
-
).then(
|
| 461 |
-
central.chat_stream,
|
| 462 |
-
[idx, local_data, instruction_txtbox, chat_state, model_num,
|
| 463 |
-
global_context, ctx_num_lconv, ctx_sum_prompt,
|
| 464 |
-
res_temp, res_topp, res_topk, res_rpen, res_mnts, res_beams, res_cache, res_sample, res_eosid, res_padid],
|
| 465 |
-
[instruction_txtbox, chatbot, context_inspector, local_data],
|
| 466 |
-
).then(
|
| 467 |
-
None, local_data, None,
|
| 468 |
-
_js="(v)=>{ setStorage('local_data',v) }"
|
| 469 |
-
)
|
| 470 |
-
|
| 471 |
-
instruction_txtbox.submit(
|
| 472 |
-
lambda: [
|
| 473 |
-
gr.update(visible=False)
|
| 474 |
-
],
|
| 475 |
-
None,
|
| 476 |
-
[example_block]
|
| 477 |
)
|
| 478 |
|
| 479 |
send_event = instruction_txtbox.submit(
|
|
@@ -482,15 +465,13 @@ Lastly, there is a hidden panel on the top right corner, and it will appear when
|
|
| 482 |
global_context, ctx_num_lconv, ctx_sum_prompt,
|
| 483 |
res_temp, res_topp, res_topk, res_rpen, res_mnts, res_beams, res_cache, res_sample, res_eosid, res_padid],
|
| 484 |
[instruction_txtbox, chatbot, context_inspector, local_data],
|
| 485 |
-
)
|
| 486 |
-
|
| 487 |
-
instruction_txtbox.submit(
|
| 488 |
None, local_data, None,
|
| 489 |
_js="(v)=>{ setStorage('local_data',v) }"
|
| 490 |
).then(
|
| 491 |
lambda: [
|
| 492 |
gr.update(interactive=True),
|
| 493 |
-
gr.update(interactive=
|
| 494 |
],
|
| 495 |
None,
|
| 496 |
[regenerate, stop]
|
|
@@ -500,37 +481,28 @@ Lastly, there is a hidden panel on the top right corner, and it will appear when
|
|
| 500 |
rollback_last,
|
| 501 |
[idx, local_data, chat_state],
|
| 502 |
[instruction_txtbox, chatbot, local_data, regenerate]
|
| 503 |
-
)
|
| 504 |
-
|
| 505 |
-
|
|
|
|
|
|
|
| 506 |
central.chat_stream,
|
| 507 |
[idx, local_data, instruction_txtbox, chat_state, model_num,
|
| 508 |
global_context, ctx_num_lconv, ctx_sum_prompt,
|
| 509 |
res_temp, res_topp, res_topk, res_rpen, res_mnts, res_beams, res_cache, res_sample, res_eosid, res_padid],
|
| 510 |
[instruction_txtbox, chatbot, context_inspector, local_data],
|
| 511 |
-
)
|
| 512 |
-
|
| 513 |
-
regenerate.click(
|
| 514 |
lambda: gr.update(interactive=True),
|
| 515 |
None,
|
| 516 |
regenerate
|
| 517 |
-
)
|
| 518 |
-
|
| 519 |
-
regenerate.click(
|
| 520 |
None, local_data, None,
|
| 521 |
_js="(v)=>{ setStorage('local_data',v) }"
|
| 522 |
-
).then(
|
| 523 |
-
lambda: [
|
| 524 |
-
gr.update(interactive=True),
|
| 525 |
-
gr.update(interactive=True),
|
| 526 |
-
],
|
| 527 |
-
None,
|
| 528 |
-
[regenerate, stop]
|
| 529 |
)
|
| 530 |
|
| 531 |
stop.click(
|
| 532 |
None, None, None,
|
| 533 |
-
cancels=[send_event
|
| 534 |
)
|
| 535 |
|
| 536 |
clean.click(
|
|
|
|
| 188 |
|
| 189 |
with gr.Row(elem_id="container"):
|
| 190 |
with gr.Column():
|
| 191 |
+
gr.Markdown("""This application is built and provided for anyone who wants to try out open source Large Language Models for free. All the provided models are pre-downloaded and pre-loaded to maximize your experience. This application is hosted on Hugging Face Space with 1 x A10 VM instance. If you want to run the same application on your own environment, be sure to check out the [project repository](https://github.com/deep-diver/LLM-As-Chatbot) for any further information.
|
| 192 |
|
| 193 |
From this page, choose a model that you would like to try out. By selecting a model, you will see more detailed description of the model in a separate page. Also note that this page will appear whenever you refresh your browser tab. """)
|
| 194 |
with gr.Row(elem_classes=["sub-container"]):
|
|
|
|
| 453 |
instruction_txtbox.submit(
|
| 454 |
lambda: [
|
| 455 |
gr.update(visible=False),
|
| 456 |
+
gr.update(visible=True)
|
| 457 |
],
|
| 458 |
None,
|
| 459 |
+
[example_block, stop]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 460 |
)
|
| 461 |
|
| 462 |
send_event = instruction_txtbox.submit(
|
|
|
|
| 465 |
global_context, ctx_num_lconv, ctx_sum_prompt,
|
| 466 |
res_temp, res_topp, res_topk, res_rpen, res_mnts, res_beams, res_cache, res_sample, res_eosid, res_padid],
|
| 467 |
[instruction_txtbox, chatbot, context_inspector, local_data],
|
| 468 |
+
).then(
|
|
|
|
|
|
|
| 469 |
None, local_data, None,
|
| 470 |
_js="(v)=>{ setStorage('local_data',v) }"
|
| 471 |
).then(
|
| 472 |
lambda: [
|
| 473 |
gr.update(interactive=True),
|
| 474 |
+
gr.update(interactive=False),
|
| 475 |
],
|
| 476 |
None,
|
| 477 |
[regenerate, stop]
|
|
|
|
| 481 |
rollback_last,
|
| 482 |
[idx, local_data, chat_state],
|
| 483 |
[instruction_txtbox, chatbot, local_data, regenerate]
|
| 484 |
+
).then(
|
| 485 |
+
lambda: gr.update(interactive=False),
|
| 486 |
+
None,
|
| 487 |
+
stop
|
| 488 |
+
).then(
|
| 489 |
central.chat_stream,
|
| 490 |
[idx, local_data, instruction_txtbox, chat_state, model_num,
|
| 491 |
global_context, ctx_num_lconv, ctx_sum_prompt,
|
| 492 |
res_temp, res_topp, res_topk, res_rpen, res_mnts, res_beams, res_cache, res_sample, res_eosid, res_padid],
|
| 493 |
[instruction_txtbox, chatbot, context_inspector, local_data],
|
| 494 |
+
).then(
|
|
|
|
|
|
|
| 495 |
lambda: gr.update(interactive=True),
|
| 496 |
None,
|
| 497 |
regenerate
|
| 498 |
+
).then(
|
|
|
|
|
|
|
| 499 |
None, local_data, None,
|
| 500 |
_js="(v)=>{ setStorage('local_data',v) }"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 501 |
)
|
| 502 |
|
| 503 |
stop.click(
|
| 504 |
None, None, None,
|
| 505 |
+
cancels=[send_event]
|
| 506 |
)
|
| 507 |
|
| 508 |
clean.click(
|