Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -90,12 +90,12 @@ with gr.Blocks(css="style.css") as demo:
|
|
90 |
login_msg = gr.Textbox(label="登录状态", interactive=False)
|
91 |
|
92 |
# 主界面
|
93 |
-
with gr.Tab("视频生成"):
|
94 |
gr.HTML(
|
95 |
"<h1><center>officechat即时视频生成系统</center></h1>" +
|
96 |
"<p><center><span style='color: red;'>如果生成效果不理想,可以将步数从4调整到8。</span></center></p>" +
|
97 |
"<p><center><strong>首次生成视频需要较长时间,之后会变快。</strong></center></p>" +
|
98 |
-
"<p><center
|
99 |
)
|
100 |
with gr.Group():
|
101 |
with gr.Row():
|
@@ -172,22 +172,20 @@ with gr.Blocks(css="style.css") as demo:
|
|
172 |
)
|
173 |
|
174 |
# 登录逻辑
|
175 |
-
def
|
|
|
176 |
if success:
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
}
|
181 |
-
return {
|
182 |
-
demo.select(0): gr.update(visible=True),
|
183 |
-
login_msg: message
|
184 |
-
}
|
185 |
|
186 |
login_button.click(
|
187 |
-
fn=
|
188 |
inputs=[username, password],
|
189 |
-
outputs=[login_msg]
|
190 |
-
_js="(success, msg) => { if(success) { window.location.hash = '#video-generation'; } return msg; }"
|
191 |
)
|
192 |
|
|
|
|
|
|
|
193 |
demo.queue().launch()
|
|
|
90 |
login_msg = gr.Textbox(label="登录状态", interactive=False)
|
91 |
|
92 |
# 主界面
|
93 |
+
with gr.Tab("视频生成") as video_tab:
|
94 |
gr.HTML(
|
95 |
"<h1><center>officechat即时视频生成系统</center></h1>" +
|
96 |
"<p><center><span style='color: red;'>如果生成效果不理想,可以将步数从4调整到8。</span></center></p>" +
|
97 |
"<p><center><strong>首次生成视频需要较长时间,之后会变快。</strong></center></p>" +
|
98 |
+
"<p><center>为获得最佳效果,请参考示例中的提示词格式(使用英文)。</center></p>"
|
99 |
)
|
100 |
with gr.Group():
|
101 |
with gr.Row():
|
|
|
172 |
)
|
173 |
|
174 |
# 登录逻辑
|
175 |
+
def handle_login(username, password):
|
176 |
+
success, message = login(username, password)
|
177 |
if success:
|
178 |
+
video_tab.visible = True
|
179 |
+
return message
|
180 |
+
return message
|
|
|
|
|
|
|
|
|
|
|
181 |
|
182 |
login_button.click(
|
183 |
+
fn=handle_login,
|
184 |
inputs=[username, password],
|
185 |
+
outputs=[login_msg]
|
|
|
186 |
)
|
187 |
|
188 |
+
# 设置视频生成标签页初始隐藏
|
189 |
+
video_tab.visible = False
|
190 |
+
|
191 |
demo.queue().launch()
|