Spaces:
Build error
Build error
File size: 1,065 Bytes
ead437b 316035a ead437b 316035a ead437b |
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 |
import gradio as gr
# Define a function to handle login logic
def login(username, password):
# Simple username/password check (for demo purposes)
if username == "admin" and password == "password123":
return "Login Successful!"
else:
return "Invalid Username or Password!"
# Create a Gradio interface
with gr.Blocks() as demo:
gr.Markdown("## Login Page") # Display the header for the page
with gr.Row():
username_input = gr.Textbox(label="Username", placeholder="Enter your username")
password_input = gr.Textbox(label="Password", placeholder="Enter your password", type="password")
login_button = gr.Button("Login") # Create the login button
# Correct the output by using gr.Textbox() instead of a string
output_text = gr.Textbox(label="Login Status") # This will display the login result
# Connect the button with the login function
login_button.click(login, inputs=[username_input, password_input], outputs=output_text)
# Launch the Gradio interface
demo.launch()
|