Rammohan0504 commited on
Commit
4c9ef03
·
verified ·
1 Parent(s): ff72661

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +42 -28
app.py CHANGED
@@ -23,32 +23,46 @@ def register(username, name, password):
23
  CUSTOMERS[username] = {"password": password, "name": name}
24
  return f"Account created successfully for {name}!"
25
 
26
- # Custom HTML and CSS for the UI
27
- HTML = """
28
- <div class="container">
29
- <div class="left">
30
- <h1>Biryani Hub</h1>
31
- <img src="https://via.placeholder.com/300" alt="Food Image">
32
- <p>Sign in with</p>
33
- <div class="social-icons">
34
- <i>Facebook</i> | <i>Twitter</i> | <i>Instagram</i>
 
 
 
 
 
 
 
 
 
 
35
  </div>
36
- </div>
37
- <div class="right">
38
- <div class="tab">
39
- <button onclick="document.getElementById('login').style.display='block'; document.getElementById('register').style.display='none';">Log In</button>
40
- <button onclick="document.getElementById('register').style.display='block'; document.getElementById('login').style.display='none';">Register</button>
41
- </div>
42
- <div id="login" style="display:block;">
43
- <h2>Log In</h2>
44
- {login}
45
- </div>
46
- <div id="register" style="display:none;">
47
- <h2>Register</h2>
48
- {register}
49
- </div>
50
- </div>
51
- </div>
52
- <style>
53
- .container {{ display: flex; height: 100vh; }}
54
- .left {{ flex: 1; background: url('https://via.placeholder.com/300') no-repeat center center;
 
 
 
 
 
23
  CUSTOMERS[username] = {"password": password, "name": name}
24
  return f"Account created successfully for {name}!"
25
 
26
+ # Gradio Blocks
27
+ def main():
28
+ with gr.Blocks() as demo:
29
+ gr.HTML("""
30
+ <div style='display: flex; height: 100vh; font-family: Arial, sans-serif;'>
31
+ <div style='flex: 1; background: url("https://via.placeholder.com/600x800") no-repeat center center; background-size: cover; color: white; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;'>
32
+ <h1 style='font-size: 3em;'>Biryani Hub</h1>
33
+ <p>Sign in with</p>
34
+ <div style='display: flex; gap: 10px;'>
35
+ <a href='#' style='color: white;'>Facebook</a> |
36
+ <a href='#' style='color: white;'>Twitter</a> |
37
+ <a href='#' style='color: white;'>Instagram</a>
38
+ </div>
39
+ </div>
40
+ <div style='flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; background: linear-gradient(to bottom, #ff7e5f, #feb47b); border-radius: 10px; color: white;'>
41
+ <div style='width: 80%;'>
42
+ <h2 style='text-align: center;'>Log In</h2>
43
+ </div>
44
+ </div>
45
  </div>
46
+ """)
47
+
48
+ with gr.Row():
49
+ with gr.Column():
50
+ gr.Markdown("### Log In")
51
+ login_username = gr.Textbox(label="Username", placeholder="Enter your username")
52
+ login_password = gr.Textbox(label="Password", placeholder="Enter your password", type="password")
53
+ login_button = gr.Button("Log In")
54
+ login_output = gr.Text(label="Login Status")
55
+ login_button.click(login, inputs=[login_username, login_password], outputs=login_output)
56
+ with gr.Column():
57
+ gr.Markdown("### Register")
58
+ register_username = gr.Textbox(label="Username", placeholder="Choose a username")
59
+ register_name = gr.Textbox(label="Name", placeholder="Enter your name")
60
+ register_password = gr.Textbox(label="Password", placeholder="Set your password", type="password")
61
+ register_button = gr.Button("Register")
62
+ register_output = gr.Text(label="Registration Status")
63
+ register_button.click(register, inputs=[register_username, register_name, register_password], outputs=register_output)
64
+
65
+ demo.launch()
66
+
67
+ if __name__ == "__main__":
68
+ main()