ljsabc commited on
Commit
03fcc17
1 Parent(s): 300a211

Incremental interface update with header and footers.

Browse files
Files changed (1) hide show
  1. app.py +13 -5
app.py CHANGED
@@ -94,13 +94,21 @@ def evaluate_stream(msg, history, temperature, top_p):
94
  #return response
95
 
96
  import gradio as gr
 
 
 
 
 
 
 
97
  with gr.Blocks() as demo:
 
98
  state = gr.State()
99
  with gr.Row():
100
  with gr.Column(scale=2):
101
- temp = gr.components.Slider(minimum=0, maximum=1.1, value=0.9, label="Temperature",
102
  info="温度参数,越高的温度生成的内容越丰富,但是有可能出现语法问题。")
103
- top_p = gr.components.Slider(minimum=0.5, maximum=1.0, value=0.97, label="Top-p",
104
  info="top-p参数,只输出前p>top-p的文字,越大生成的内容越丰富,但也可能出现语法问题。数字越小似乎上下文的衔接性越好。")
105
  #code = gr.Textbox(label="temp_output", info="解码器输出")
106
  #top_k = gr.components.Slider(minimum=1, maximum=200, step=1, value=25, label="Top k",
@@ -109,12 +117,12 @@ with gr.Blocks() as demo:
109
  with gr.Column(scale=3):
110
  chatbot = gr.Chatbot(label="聊天框", info="")
111
  msg = gr.Textbox(label="输入框", placeholder="最近过得怎么样?",
112
- info="输入你的内容,按[Enter]发送。也可以什么都不填写生成随机数据。聊天会追随上下文,如果要换个话题建议按下按钮清除聊天。")
113
  clear = gr.Button("清除聊天")
114
 
115
  msg.submit(evaluate_stream, [msg, chatbot, temp, top_p], [chatbot, msg])
116
  clear.click(lambda: None, None, chatbot, queue=False)
117
-
118
 
119
  demo.queue()
120
- demo.launch(debug=False)
 
94
  #return response
95
 
96
  import gradio as gr
97
+
98
+ title = """<h1 align="center">李萌萌(Alter Ego)</h1>
99
+ <h3 align="center">这是一个通过ChatGLM模型训练的李萌萌的数字分身,你可以与她聊天,或者直接在文本框按下Enter,来观察李萌萌到底会说些什么。</h3>"""
100
+
101
+ footer = """<p align='center'>项目在<a href='https://github.com/ljsabc/Fujisaki' target='_blank'>GitHub</a>上托管,基于清华的<a href='https://huggingface.co/THUDM/chatglm-6b' target='_blank'>THUDM/chatglm-6b</a>项目。</p>
102
+ <p align='center'><em>"I'm... a boy." --Chihiro Fujisaki</em></p>"""
103
+
104
  with gr.Blocks() as demo:
105
+ gr.HTML(title)
106
  state = gr.State()
107
  with gr.Row():
108
  with gr.Column(scale=2):
109
+ temp = gr.components.Slider(minimum=0, maximum=1.1, value=0.95, label="Temperature",
110
  info="温度参数,越高的温度生成的内容越丰富,但是有可能出现语法问题。")
111
+ top_p = gr.components.Slider(minimum=0.5, maximum=1.0, value=0.99, label="Top-p",
112
  info="top-p参数,只输出前p>top-p的文字,越大生成的内容越丰富,但也可能出现语法问题。数字越小似乎上下文的衔接性越好。")
113
  #code = gr.Textbox(label="temp_output", info="解码器输出")
114
  #top_k = gr.components.Slider(minimum=1, maximum=200, step=1, value=25, label="Top k",
 
117
  with gr.Column(scale=3):
118
  chatbot = gr.Chatbot(label="聊天框", info="")
119
  msg = gr.Textbox(label="输入框", placeholder="最近过得怎么样?",
120
+ info="输入你的内容,按[Enter]发送。也可以什么都不填写生成随机数据。")
121
  clear = gr.Button("清除聊天")
122
 
123
  msg.submit(evaluate_stream, [msg, chatbot, temp, top_p], [chatbot, msg])
124
  clear.click(lambda: None, None, chatbot, queue=False)
125
+ gr.HTML(footer)
126
 
127
  demo.queue()
128
+ demo.launch(debug=False)