Spaces:
Runtime error
Runtime error
Commit
·
67b3432
1
Parent(s):
916dab3
Update app.py
Browse files
app.py
CHANGED
@@ -110,7 +110,7 @@ input {border: none; border-bottom: 1px solid #ccc; outline: none;}
|
|
110 |
model = gr.Radio(choices=['gpt-3.5-turbo','gpt-3.5-turbo-16k', 'gpt-4'], label='模型 🤖')
|
111 |
gr.HTML('<h2 style="font-size: 18px; color: #333;">🗨️ 主聊天框 🗨️</h2>')
|
112 |
chatbot = gr.Chatbot(elem_id='chatbot')
|
113 |
-
inputs = gr.Textbox(placeholder= "
|
114 |
state = gr.State([])
|
115 |
b1 = gr.Button("🚀 发送", color='#5e9ca0')
|
116 |
b2 = gr.Button("🧹 清除所有聊天内容", color='#5e9ca0')
|
@@ -126,11 +126,12 @@ input {border: none; border-bottom: 1px solid #ccc; outline: none;}
|
|
126 |
b1.click( predict, [inputs, system_input, presence_penalty, frequency_penalty, temperature, openai_api_key, model, chat_counter, chatbot, state], [chatbot, state, chat_counter],)
|
127 |
b2.click(reset_all, [chatbot, state, chat_counter], [chatbot, state, chat_counter])
|
128 |
inputs.submit(reset_textbox, [], [inputs])
|
|
|
129 |
with gr.Column(width=3):
|
130 |
model2 = gr.Radio(choices=['gpt-3.5-turbo','gpt-3.5-turbo-16k', 'gpt-4'], label='模型 🤖')
|
131 |
gr.HTML('<h2 style="font-size: 18px; color: #333;">🗨️ 副聊天框(可用于生成主聊天的系统消息等)🗨️</h2>')
|
132 |
chatbot2 = gr.Chatbot(elem_id='chatbot2')
|
133 |
-
inputs2 = gr.Textbox(placeholder= "
|
134 |
state2 = gr.State([])
|
135 |
b3 = gr.Button("🚀 发送", color='#5e9ca0')
|
136 |
b4 = gr.Button("🧹 清除所有聊天内容", color='#5e9ca0')
|
@@ -146,4 +147,5 @@ input {border: none; border-bottom: 1px solid #ccc; outline: none;}
|
|
146 |
b3.click( predict, [inputs2, system_input2, presence_penalty2, frequency_penalty2, temperature2, openai_api_key, model2, chat_counter2, chatbot2, state2], [chatbot2, state2, chat_counter2],)
|
147 |
b4.click(reset_all, [chatbot2, state2, chat_counter2], [chatbot2, state2, chat_counter2])
|
148 |
inputs2.submit(reset_textbox, [], [inputs2])
|
|
|
149 |
demo.queue().launch(debug=True)
|
|
|
110 |
model = gr.Radio(choices=['gpt-3.5-turbo','gpt-3.5-turbo-16k', 'gpt-4'], label='模型 🤖')
|
111 |
gr.HTML('<h2 style="font-size: 18px; color: #333;">🗨️ 主聊天框 🗨️</h2>')
|
112 |
chatbot = gr.Chatbot(elem_id='chatbot')
|
113 |
+
inputs = gr.Textbox(placeholder= "你好呀!", label= "🙋♀️输入并按 Enter ↵")
|
114 |
state = gr.State([])
|
115 |
b1 = gr.Button("🚀 发送", color='#5e9ca0')
|
116 |
b2 = gr.Button("🧹 清除所有聊天内容", color='#5e9ca0')
|
|
|
126 |
b1.click( predict, [inputs, system_input, presence_penalty, frequency_penalty, temperature, openai_api_key, model, chat_counter, chatbot, state], [chatbot, state, chat_counter],)
|
127 |
b2.click(reset_all, [chatbot, state, chat_counter], [chatbot, state, chat_counter])
|
128 |
inputs.submit(reset_textbox, [], [inputs])
|
129 |
+
b1.click(reset_textbox, [], [inputs])
|
130 |
with gr.Column(width=3):
|
131 |
model2 = gr.Radio(choices=['gpt-3.5-turbo','gpt-3.5-turbo-16k', 'gpt-4'], label='模型 🤖')
|
132 |
gr.HTML('<h2 style="font-size: 18px; color: #333;">🗨️ 副聊天框(可用于生成主聊天的系统消息等)🗨️</h2>')
|
133 |
chatbot2 = gr.Chatbot(elem_id='chatbot2')
|
134 |
+
inputs2 = gr.Textbox(placeholder= "哈喽!", label= "🙋♀️输入并按 Enter ↵")
|
135 |
state2 = gr.State([])
|
136 |
b3 = gr.Button("🚀 发送", color='#5e9ca0')
|
137 |
b4 = gr.Button("🧹 清除所有聊天内容", color='#5e9ca0')
|
|
|
147 |
b3.click( predict, [inputs2, system_input2, presence_penalty2, frequency_penalty2, temperature2, openai_api_key, model2, chat_counter2, chatbot2, state2], [chatbot2, state2, chat_counter2],)
|
148 |
b4.click(reset_all, [chatbot2, state2, chat_counter2], [chatbot2, state2, chat_counter2])
|
149 |
inputs2.submit(reset_textbox, [], [inputs2])
|
150 |
+
b3.click(reset_textbox, [], [inputs2])
|
151 |
demo.queue().launch(debug=True)
|