parass13 commited on
Commit
e6b1bc3
·
verified ·
1 Parent(s): b55b191

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +51 -19
app.py CHANGED
@@ -4,10 +4,18 @@ import gradio as gr
4
  from components.auth import register, login, logout
5
  from components.predict import predict
6
 
7
- # --- UI Layout and Theming ---
8
- theme = gr.themes.Soft(primary_hue="blue", secondary_hue="sky")
9
-
10
- with gr.Blocks(title="Diabetech Predict", theme=theme, css=".gradio-container {max-width: 960px !important}") as demo:
 
 
 
 
 
 
 
 
11
 
12
  # A state object to hold the user's session information
13
  user_state = gr.State({"email": None, "logged_in": False})
@@ -16,8 +24,9 @@ with gr.Blocks(title="Diabetech Predict", theme=theme, css=".gradio-container {m
16
  with gr.Row(equal_height=False):
17
  with gr.Column(scale=4):
18
  gr.Markdown("# 🩺 Welcome to Diabetech Predict")
 
19
 
20
- with gr.Column(scale=1):
21
  login_status_display = gr.Textbox(
22
  label="Current User",
23
  value="Not logged in",
@@ -28,35 +37,58 @@ with gr.Blocks(title="Diabetech Predict", theme=theme, css=".gradio-container {m
28
  # --- Main Tabs ---
29
  with gr.Tabs():
30
 
31
- # --- Homepage Tab ---
32
  with gr.TabItem("Home"):
33
- gr.Markdown("## Your Personal Diabetes Risk Forecaster")
34
  gr.Markdown(
35
  """
36
- **Diabetech Predict** uses a machine learning model to help you assess your risk of diabetes based on key health indicators.
37
-
38
- ### How It Works:
39
- 1. **Sign Up & Login:** Go to the 'Login / Signup' tab to create a secure account. Your password must be at least 6 characters long.
40
- 2. **Navigate to Prediction:** Once logged in, go to the 'Prediction' tab.
41
- 3. **Enter Health Data & Predict:** Input your health metrics to get an instant risk assessment. Your results are logged privately to your account.
42
-
43
- *Disclaimer: This tool is for informational purposes only and is not a substitute for professional medical advice.*
44
  """
45
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
 
47
- # --- Authentication Tab ---
48
  with gr.TabItem("Login / Signup"):
49
  auth_message = gr.Markdown()
50
  with gr.Row():
51
  with gr.Column(scale=1):
52
  gr.Markdown("### Sign Up")
53
  email_signup = gr.Textbox(label="Email", placeholder="Enter your email")
54
- # THIS IS THE MODIFIED LINE
55
  pwd_signup = gr.Textbox(
56
  label="Password",
57
  type="password",
58
  placeholder="Create a password",
59
- info="Must be at least 6 characters long." # <-- ADDED HINT
60
  )
61
  signup_btn = gr.Button("Sign Up", variant="primary")
62
 
@@ -68,7 +100,7 @@ with gr.Blocks(title="Diabetech Predict", theme=theme, css=".gradio-container {m
68
 
69
  logout_btn = gr.Button("Logout")
70
 
71
- # --- Prediction Tab ---
72
  with gr.TabItem("Prediction"):
73
  with gr.Row():
74
  with gr.Column():
 
4
  from components.auth import register, login, logout
5
  from components.predict import predict
6
 
7
+ # --- 1. New Theme and Style ---
8
+ # We are using the "Glass" theme for a modern, clean look.
9
+ # Custom CSS is added to center the content and give it a max-width for better readability on large screens.
10
+ theme = gr.themes.Glass(
11
+ primary_hue="teal",
12
+ secondary_hue="sky",
13
+ neutral_hue="slate"
14
+ ).set(
15
+ body_background_fill='linear-gradient(to right, #F0F8FF, #E6E6FA)',
16
+ )
17
+
18
+ with gr.Blocks(title="Diabetech Predict", theme=theme, css=".gradio-container {max-width: 1000px; margin: auto;}") as demo:
19
 
20
  # A state object to hold the user's session information
21
  user_state = gr.State({"email": None, "logged_in": False})
 
24
  with gr.Row(equal_height=False):
25
  with gr.Column(scale=4):
26
  gr.Markdown("# 🩺 Welcome to Diabetech Predict")
27
+ gr.Markdown("#### Your Proactive Partner in Health Awareness")
28
 
29
+ with gr.Column(scale=1, min_width=200):
30
  login_status_display = gr.Textbox(
31
  label="Current User",
32
  value="Not logged in",
 
37
  # --- Main Tabs ---
38
  with gr.Tabs():
39
 
40
+ # --- 2. New Homepage Tab with Richer Content ---
41
  with gr.TabItem("Home"):
42
+ gr.Markdown("## Understand Your Diabetes Risk, Privately and Securely")
43
  gr.Markdown(
44
  """
45
+ **Diabetech Predict is a free, confidential tool designed to help you understand your potential risk factors for type 2 diabetes.**
46
+ By using a machine learning model, our application provides an instant analysis based on key health metrics. This is not a diagnosis, but an educational first step to empower you on your health journey.
 
 
 
 
 
 
47
  """
48
  )
49
+ gr.Markdown("---")
50
+
51
+ with gr.Row():
52
+ with gr.Column():
53
+ gr.Markdown("### Why Use Diabetech Predict?")
54
+ gr.Markdown(
55
+ """
56
+ * **📈 Gain Insight:** Learn how different health factors like Glucose levels and BMI contribute to your risk profile.
57
+ * **🧠 Promote Awareness:** Being aware of potential risks is the first step towards preventive care and healthier lifestyle choices.
58
+ * **🔒 Completely Private:** Your data is your own. With our secure login system, your prediction history is tied to your account and is never shared.
59
+ """
60
+ )
61
+ with gr.Column():
62
+ gr.Markdown("### How It Works")
63
+ gr.Markdown(
64
+ """
65
+ 1. **Create Your Secure Account:** Use the 'Login / Signup' tab to create a free, private account.
66
+ 2. **Enter Your Health Metrics:** Navigate to the 'Prediction' tab and input your information into the provided fields.
67
+ 3. **Receive Your Instant Analysis:** Our model will provide an immediate risk assessment based on the data you provided.
68
+ """
69
+ )
70
+
71
+ gr.Markdown("### An Important Note on Your Health")
72
+ gr.Markdown(
73
+ """
74
+ **Disclaimer:** This tool is for informational and educational purposes **only**.
75
+ The prediction it provides is not a medical diagnosis. Please consult with a qualified healthcare professional for any health concerns, diagnosis, or before making any decisions related to your health.
76
+ """
77
+ )
78
+
79
 
80
+ # --- Authentication Tab (No changes here) ---
81
  with gr.TabItem("Login / Signup"):
82
  auth_message = gr.Markdown()
83
  with gr.Row():
84
  with gr.Column(scale=1):
85
  gr.Markdown("### Sign Up")
86
  email_signup = gr.Textbox(label="Email", placeholder="Enter your email")
 
87
  pwd_signup = gr.Textbox(
88
  label="Password",
89
  type="password",
90
  placeholder="Create a password",
91
+ info="Must be at least 6 characters long."
92
  )
93
  signup_btn = gr.Button("Sign Up", variant="primary")
94
 
 
100
 
101
  logout_btn = gr.Button("Logout")
102
 
103
+ # --- Prediction Tab (No changes here) ---
104
  with gr.TabItem("Prediction"):
105
  with gr.Row():
106
  with gr.Column():