Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -392,12 +392,11 @@ ul, ol {
|
|
392 |
}
|
393 |
"""
|
394 |
|
395 |
-
# Add login function
|
396 |
def login(username, password):
|
397 |
if username == USERNAME and password == PASSWORD:
|
398 |
-
return gr.update(visible=True), gr.update(visible=False), gr.update(visible=False)
|
399 |
else:
|
400 |
-
return gr.update(visible=False), gr.update(visible=True), gr.update(visible=True)
|
401 |
|
402 |
# Add login elements to the Gradio interface
|
403 |
with gr.Blocks(theme='Hev832/Applio', css=css, fill_width=True, fill_height=True) as blocks:
|
@@ -438,7 +437,7 @@ with gr.Blocks(theme='Hev832/Applio', css=css, fill_width=True, fill_height=True
|
|
438 |
password = gr.Textbox(label="Password", type="password", placeholder="Enter your password")
|
439 |
with gr.Row():
|
440 |
login_button = gr.Button("Login", size="sm")
|
441 |
-
|
442 |
|
443 |
|
444 |
with gr.Tab("QR Code and Prompt Input", visible=False) as app_container:
|
@@ -800,19 +799,18 @@ with gr.Blocks(theme='Hev832/Applio', css=css, fill_width=True, fill_height=True
|
|
800 |
login_button.click(
|
801 |
login,
|
802 |
inputs=[username, password],
|
803 |
-
outputs=[app_container,
|
804 |
)
|
805 |
|
806 |
# Define password textbox submit behavior
|
807 |
password.submit(
|
808 |
login,
|
809 |
inputs=[username, password],
|
810 |
-
outputs=[app_container,
|
811 |
)
|
812 |
|
813 |
-
|
814 |
# Load models on launch
|
815 |
load_models_on_launch()
|
816 |
|
817 |
blocks.queue(max_size=20)
|
818 |
-
blocks.launch(share=
|
|
|
392 |
}
|
393 |
"""
|
394 |
|
|
|
395 |
def login(username, password):
|
396 |
if username == USERNAME and password == PASSWORD:
|
397 |
+
return gr.update(visible=True), gr.update(visible=False), gr.update(visible=False), gr.update(value="Login successful! You can now access the QR Code Art Generator tab.", visible=True)
|
398 |
else:
|
399 |
+
return gr.update(visible=False), gr.update(visible=True), gr.update(visible=True), gr.update(value="Invalid username or password. Please try again.", visible=True)
|
400 |
|
401 |
# Add login elements to the Gradio interface
|
402 |
with gr.Blocks(theme='Hev832/Applio', css=css, fill_width=True, fill_height=True) as blocks:
|
|
|
437 |
password = gr.Textbox(label="Password", type="password", placeholder="Enter your password")
|
438 |
with gr.Row():
|
439 |
login_button = gr.Button("Login", size="sm")
|
440 |
+
login_message = gr.Markdown(visible=False)
|
441 |
|
442 |
|
443 |
with gr.Tab("QR Code and Prompt Input", visible=False) as app_container:
|
|
|
799 |
login_button.click(
|
800 |
login,
|
801 |
inputs=[username, password],
|
802 |
+
outputs=[app_container, login_message, login_button, login_message]
|
803 |
)
|
804 |
|
805 |
# Define password textbox submit behavior
|
806 |
password.submit(
|
807 |
login,
|
808 |
inputs=[username, password],
|
809 |
+
outputs=[app_container, login_message, login_button, login_message]
|
810 |
)
|
811 |
|
|
|
812 |
# Load models on launch
|
813 |
load_models_on_launch()
|
814 |
|
815 |
blocks.queue(max_size=20)
|
816 |
+
blocks.launch(share=False, show_api=True)
|