Skip to content

Commit fb166dc

Browse files
committed
Update color of chat demo.
1 parent 32bc50b commit fb166dc

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

chat_demo.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@
66
from transformers import AutoModelForCausalLM, AutoTokenizer,GenerationConfig
77

88
tokenizer, model = None, None
9+
css = """
10+
.message.user{
11+
border-color: #BFB0FA !important;
12+
background: #EEEAFF !important;
13+
}
14+
.message.bot{
15+
border-color: #CDCDCD !important;
16+
background: #F8F8F8 !important;
17+
}
18+
"""
919

1020
def init_model(args):
1121
global tokenizer, model
@@ -57,13 +67,13 @@ def get_args():
5767
init_model(args)
5868

5969
# 构建demo应用
60-
with gr.Blocks() as demo:
70+
with gr.Blocks(css=css) as demo:
6171
gr.Markdown("# <center>{}</center>".format(args.title))
62-
chatbot = gr.Chatbot(label="Chat history", height=650).style(color_map=("green", "pink"))
72+
chatbot = gr.Chatbot(label="Chat history", height=650)
6373
state = gr.State([])
6474

6575
with gr.Row():
66-
text_box = gr.Textbox(label="Message", show_label=False, placeholder="Enter message and press enter").style(container=False)
76+
text_box = gr.Textbox(label="Message", show_label=False, placeholder="Enter message and press enter")
6777

6878
with gr.Row():
6979
submit_btn = gr.Button(value="Send", variant="secondary")

0 commit comments

Comments
 (0)