Spaces:
Sleeping
Sleeping
Alfie Grace
commited on
Commit
·
5b77bc2
1
Parent(s):
684ee5c
Added custom colours to Gradio components
Browse files
app.py
CHANGED
@@ -572,7 +572,7 @@ def update_use_embeddings(widget, state):
|
|
572 |
return state
|
573 |
|
574 |
|
575 |
-
with gr.Blocks(css=".gradio-container {background-color:
|
576 |
llm_state = gr.State()
|
577 |
history_state = gr.State()
|
578 |
chain_state = gr.State()
|
@@ -608,29 +608,30 @@ with gr.Blocks(css=".gradio-container {background-color: black}") as block:
|
|
608 |
docsearch_state = gr.State()
|
609 |
use_embeddings_state = gr.State(False)
|
610 |
|
611 |
-
with gr.Tab("Chat"):
|
612 |
with gr.Row():
|
613 |
openai_api_key_textbox = gr.Textbox(placeholder="Paste your OpenAI API key (sk-...)",
|
614 |
show_label=False, lines=1, type='password')
|
615 |
|
616 |
with gr.Row():
|
617 |
with gr.Column(scale=7):
|
618 |
-
chatbot = gr.Chatbot()
|
619 |
|
620 |
with gr.Row():
|
621 |
message = gr.Textbox(label="What's on your mind?",
|
622 |
placeholder="What's the answer to life, the universe, and everything?",
|
623 |
-
lines=1
|
|
|
624 |
submit = gr.Button(value="Send", variant="secondary").style(full_width=False)
|
625 |
|
626 |
with gr.Tab("Settings"):
|
627 |
tools_cb_group = gr.CheckboxGroup(label="Tools:", choices=TOOLS_LIST,
|
628 |
-
value=TOOLS_DEFAULT_LIST)
|
629 |
tools_cb_group.change(update_selected_tools,
|
630 |
inputs=[tools_cb_group, tools_list_state, llm_state],
|
631 |
outputs=[tools_list_state, llm_state, chain_state, express_chain_state])
|
632 |
|
633 |
-
trace_chain_cb = gr.Checkbox(label="Show reasoning chain in chat bubble", value=False)
|
634 |
trace_chain_cb.change(update_foo, inputs=[trace_chain_cb, trace_chain_state],
|
635 |
outputs=[trace_chain_state])
|
636 |
|
@@ -647,7 +648,7 @@ with gr.Blocks(css=".gradio-container {background-color: black}") as block:
|
|
647 |
# monologue_cb.change(update_foo, inputs=[monologue_cb, monologue_state],
|
648 |
# outputs=[monologue_state])
|
649 |
|
650 |
-
reset_btn = gr.Button(value="Reset chat", variant="secondary").style(full_width=False)
|
651 |
reset_btn.click(reset_memory, inputs=[history_state, memory_state], outputs=[chatbot, history_state, memory_state])
|
652 |
|
653 |
message.submit(chat, inputs=[openai_api_key_textbox, message, history_state, chain_state, trace_chain_state,
|
@@ -677,4 +678,4 @@ with gr.Blocks(css=".gradio-container {background-color: black}") as block:
|
|
677 |
outputs=[chain_state, express_chain_state, llm_state, embeddings_state,
|
678 |
qa_chain_state, memory_state])
|
679 |
|
680 |
-
block.launch(debug=True)
|
|
|
572 |
return state
|
573 |
|
574 |
|
575 |
+
with gr.Blocks(css=".gradio-container {background-color: #090c17} #gr-component {background-color: #202937}") as block:
|
576 |
llm_state = gr.State()
|
577 |
history_state = gr.State()
|
578 |
chain_state = gr.State()
|
|
|
608 |
docsearch_state = gr.State()
|
609 |
use_embeddings_state = gr.State(False)
|
610 |
|
611 |
+
with gr.Tab("Chat", elem_id="gr-component"):
|
612 |
with gr.Row():
|
613 |
openai_api_key_textbox = gr.Textbox(placeholder="Paste your OpenAI API key (sk-...)",
|
614 |
show_label=False, lines=1, type='password')
|
615 |
|
616 |
with gr.Row():
|
617 |
with gr.Column(scale=7):
|
618 |
+
chatbot = gr.Chatbot(elem_id="gr-component")
|
619 |
|
620 |
with gr.Row():
|
621 |
message = gr.Textbox(label="What's on your mind?",
|
622 |
placeholder="What's the answer to life, the universe, and everything?",
|
623 |
+
lines=1,
|
624 |
+
elem_id="gr-component")
|
625 |
submit = gr.Button(value="Send", variant="secondary").style(full_width=False)
|
626 |
|
627 |
with gr.Tab("Settings"):
|
628 |
tools_cb_group = gr.CheckboxGroup(label="Tools:", choices=TOOLS_LIST,
|
629 |
+
value=TOOLS_DEFAULT_LIST, elem_id="gr-component")
|
630 |
tools_cb_group.change(update_selected_tools,
|
631 |
inputs=[tools_cb_group, tools_list_state, llm_state],
|
632 |
outputs=[tools_list_state, llm_state, chain_state, express_chain_state])
|
633 |
|
634 |
+
trace_chain_cb = gr.Checkbox(label="Show reasoning chain in chat bubble", value=False, elem_id="gr-component")
|
635 |
trace_chain_cb.change(update_foo, inputs=[trace_chain_cb, trace_chain_state],
|
636 |
outputs=[trace_chain_state])
|
637 |
|
|
|
648 |
# monologue_cb.change(update_foo, inputs=[monologue_cb, monologue_state],
|
649 |
# outputs=[monologue_state])
|
650 |
|
651 |
+
reset_btn = gr.Button(value="Reset chat", variant="secondary").style(full_width=False, elem_id="gr-component")
|
652 |
reset_btn.click(reset_memory, inputs=[history_state, memory_state], outputs=[chatbot, history_state, memory_state])
|
653 |
|
654 |
message.submit(chat, inputs=[openai_api_key_textbox, message, history_state, chain_state, trace_chain_state,
|
|
|
678 |
outputs=[chain_state, express_chain_state, llm_state, embeddings_state,
|
679 |
qa_chain_state, memory_state])
|
680 |
|
681 |
+
block.launch(debug=True, share=True)
|