-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain-old.py
54 lines (45 loc) · 1.5 KB
/
main-old.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
"""
@Author:Huterox
@Description:Go For It
@Time:2024/4/16 8:58
@Copyright:©2018-2024 awesome!
"""
import os
import gradio as gr
from utils import getConfig
from webui.gradio.chat import ChatBotComponent
from handler.helperChat import ChatBotHandler
from webui.gradio.novel import NovelComponent
from webui.gradio.setting import SettingComponent
my_theme = gr.Theme.load("./theme/miku.json")
config = getConfig()
"""
*************注意,当前所有的功能都将封装到组件当中,换一句话说所有的base功能实现都在handler里面***********
"""
if __name__ == '__main__':
os.environ["no_proxy"] = "localhost,127.0.0.1,::1"
with gr.Blocks(
title='Novel tweet generator',
theme=my_theme,
fill_height = False,
css="""
footer {visibility: hidden}
""",
) as demo:
title = gr.Markdown("#### 创作生成器v0.1-beta( ̄︶ ̄)↗ ")
# 顶部tag导航
with gr.Tab(label="Novel助手"):
# chat 对话机器人
chat = ChatBotComponent(gr)
# chat.set_response(ChatBotHandler().chat)
chat.set_streamBot(ChatBotHandler())
chat.creat()
with gr.Tab(label="Novel合成"):
# novel合成
novel = NovelComponent(gr)
novel.create()
with gr.Tab(label="key设置"):
# 设置页面
setting = SettingComponent(gr)
setting.create()
demo.launch(share=config.get("share",True))