Spaces:
Runtime error
Runtime error
Commit
·
de56e16
1
Parent(s):
22e352b
Upload ChuanhuChatbot.py
Browse files- ChuanhuChatbot.py +10 -11
ChuanhuChatbot.py
CHANGED
@@ -30,11 +30,10 @@ with gr.Blocks(css=customCSS, theme=small_and_beautiful_theme) as demo:
|
|
30 |
topic = gr.State("未命名对话历史记录")
|
31 |
|
32 |
with gr.Row():
|
33 |
-
|
34 |
-
gr.HTML(title)
|
35 |
-
user_info = gr.Markdown(value="", elem_id="user_info")
|
36 |
-
gr.HTML('<center><a href="https://huggingface.co/spaces/JohnSmith9982/ChuanhuChatGPT?duplicate=true"><img src="https://bit.ly/3gLdBN6" alt="Duplicate Space"></a></center>')
|
37 |
status_display = gr.Markdown(get_geoip(), elem_id="status_display")
|
|
|
|
|
38 |
|
39 |
# https://github.com/gradio-app/gradio/pull/3296
|
40 |
def create_greeting(request: gr.Request):
|
@@ -50,14 +49,14 @@ with gr.Blocks(css=customCSS, theme=small_and_beautiful_theme) as demo:
|
|
50 |
with gr.Row():
|
51 |
chatbot = gr.Chatbot(elem_id="chuanhu_chatbot").style(height="100%")
|
52 |
with gr.Row():
|
53 |
-
with gr.Column(scale=12):
|
54 |
user_input = gr.Textbox(
|
55 |
elem_id="user_input_tb",
|
56 |
show_label=False, placeholder="在这里输入"
|
57 |
).style(container=False)
|
58 |
-
with gr.Column(min_width=
|
59 |
-
submitBtn = gr.Button("
|
60 |
-
cancelBtn = gr.Button("
|
61 |
with gr.Row():
|
62 |
emptyBtn = gr.Button(
|
63 |
"🧹 新的对话",
|
@@ -181,7 +180,7 @@ with gr.Blocks(css=customCSS, theme=small_and_beautiful_theme) as demo:
|
|
181 |
label="Temperature",
|
182 |
)
|
183 |
|
184 |
-
with gr.Accordion("网络设置", open=False
|
185 |
# 优先展示自定义的api_host
|
186 |
apihostTxt = gr.Textbox(
|
187 |
show_label=True,
|
@@ -385,7 +384,7 @@ logging.info(
|
|
385 |
+ colorama.Style.RESET_ALL
|
386 |
)
|
387 |
# 默认开启本地服务器,默认可以直接从IP访问,默认不创建公开分享链接
|
388 |
-
demo.title = "
|
389 |
|
390 |
if __name__ == "__main__":
|
391 |
reload_javascript()
|
@@ -418,6 +417,6 @@ if __name__ == "__main__":
|
|
418 |
demo.queue(concurrency_count=CONCURRENT_COUNT).launch(
|
419 |
share=False, favicon_path="./assets/favicon.ico", inbrowser=True
|
420 |
) # 改为 share=True 可以创建公开分享链接
|
421 |
-
|
422 |
# demo.queue(concurrency_count=CONCURRENT_COUNT).launch(server_name="0.0.0.0", server_port=7860,auth=("在这里填写用户名", "在这里填写密码")) # 可设置用户名与密码
|
423 |
# demo.queue(concurrency_count=CONCURRENT_COUNT).launch(auth=("在这里填写用户名", "在这里填写密码")) # 适合Nginx反向代理
|
|
|
30 |
topic = gr.State("未命名对话历史记录")
|
31 |
|
32 |
with gr.Row():
|
33 |
+
gr.HTML(title, elem_id="app_title")
|
|
|
|
|
|
|
34 |
status_display = gr.Markdown(get_geoip(), elem_id="status_display")
|
35 |
+
with gr.Row(elem_id="float_display"):
|
36 |
+
user_info = gr.Markdown(value="getting user info...", elem_id="user_info")
|
37 |
|
38 |
# https://github.com/gradio-app/gradio/pull/3296
|
39 |
def create_greeting(request: gr.Request):
|
|
|
49 |
with gr.Row():
|
50 |
chatbot = gr.Chatbot(elem_id="chuanhu_chatbot").style(height="100%")
|
51 |
with gr.Row():
|
52 |
+
with gr.Column(min_width=225, scale=12):
|
53 |
user_input = gr.Textbox(
|
54 |
elem_id="user_input_tb",
|
55 |
show_label=False, placeholder="在这里输入"
|
56 |
).style(container=False)
|
57 |
+
with gr.Column(min_width=42, scale=1):
|
58 |
+
submitBtn = gr.Button(value="", variant="primary", elem_id="submit_btn")
|
59 |
+
cancelBtn = gr.Button(value="", variant="secondary", visible=False, elem_id="cancel_btn")
|
60 |
with gr.Row():
|
61 |
emptyBtn = gr.Button(
|
62 |
"🧹 新的对话",
|
|
|
180 |
label="Temperature",
|
181 |
)
|
182 |
|
183 |
+
with gr.Accordion("网络设置", open=False):
|
184 |
# 优先展示自定义的api_host
|
185 |
apihostTxt = gr.Textbox(
|
186 |
show_label=True,
|
|
|
384 |
+ colorama.Style.RESET_ALL
|
385 |
)
|
386 |
# 默认开启本地服务器,默认可以直接从IP访问,默认不创建公开分享链接
|
387 |
+
demo.title = "TanLanChatGPT"
|
388 |
|
389 |
if __name__ == "__main__":
|
390 |
reload_javascript()
|
|
|
417 |
demo.queue(concurrency_count=CONCURRENT_COUNT).launch(
|
418 |
share=False, favicon_path="./assets/favicon.ico", inbrowser=True
|
419 |
) # 改为 share=True 可以创建公开分享链接
|
420 |
+
demo.queue(concurrency_count=CONCURRENT_COUNT).launch(server_name="0.0.0.0", server_port=7860, share=True) # 可自定义端口
|
421 |
# demo.queue(concurrency_count=CONCURRENT_COUNT).launch(server_name="0.0.0.0", server_port=7860,auth=("在这里填写用户名", "在这里填写密码")) # 可设置用户名与密码
|
422 |
# demo.queue(concurrency_count=CONCURRENT_COUNT).launch(auth=("在这里填写用户名", "在这里填写密码")) # 适合Nginx反向代理
|