File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change 66from transformers import AutoModelForCausalLM , AutoTokenizer ,GenerationConfig
77
88tokenizer , 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
1020def 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" )
You can’t perform that action at this time.
0 commit comments