Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
# Define a function to handle login logic
|
| 4 |
+
def login(username, password):
|
| 5 |
+
# Simple username/password check (for demo purposes)
|
| 6 |
+
if username == "admin" and password == "password123":
|
| 7 |
+
return "Login Successful!"
|
| 8 |
+
else:
|
| 9 |
+
return "Invalid Username or Password!"
|
| 10 |
+
|
| 11 |
+
# Create a Gradio interface
|
| 12 |
+
with gr.Blocks() as demo:
|
| 13 |
+
gr.Markdown("## Login Page") # Display the header for the page
|
| 14 |
+
|
| 15 |
+
with gr.Row():
|
| 16 |
+
username_input = gr.Textbox(label="Username", placeholder="Enter your username")
|
| 17 |
+
password_input = gr.Textbox(label="Password", placeholder="Enter your password", type="password")
|
| 18 |
+
|
| 19 |
+
login_button = gr.Button("Login") # Create the login button
|
| 20 |
+
|
| 21 |
+
# Connect the button with the login function
|
| 22 |
+
login_button.click(login, inputs=[username_input, password_input], outputs="text")
|
| 23 |
+
|
| 24 |
+
# Launch the Gradio interface
|
| 25 |
+
demo.launch()
|