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()