Pontonkid commited on
Commit
d5f6a93
·
verified ·
1 Parent(s): c42c62f

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +276 -176
src/streamlit_app.py CHANGED
@@ -1,10 +1,13 @@
1
  import streamlit as st
2
  import os
3
- import google.generativeai as genai # <--- Fixed import for your environment
 
 
4
  from PIL import Image
 
5
 
6
  # -----------------------------------------------------------------------------
7
- # 0. AUTO-CONFIG
8
  # -----------------------------------------------------------------------------
9
  config_dir = ".streamlit"
10
  if not os.path.exists(config_dir):
@@ -13,227 +16,324 @@ with open(os.path.join(config_dir, "config.toml"), "w") as f:
13
  f.write("[server]\nenableXsrfProtection=false\nenableCORS=false\nmaxUploadSize=200\n")
14
 
15
  # -----------------------------------------------------------------------------
16
- # 1. SETUP & GOOGLE API
17
  # -----------------------------------------------------------------------------
18
- st.set_page_config(page_title="Shinui | Medical AI", page_icon="✨", layout="wide")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
 
20
  GOOGLE_API_KEY = os.environ.get("GOOGLE_API_KEY")
21
  if not GOOGLE_API_KEY:
22
- st.error("⚠️ Google API Key Missing in Secrets.")
23
  st.stop()
24
 
25
- # Configure the standard library
26
  genai.configure(api_key=GOOGLE_API_KEY)
 
27
 
28
  # -----------------------------------------------------------------------------
29
- # ⚠️ MODEL CONFIGURATION
30
  # -----------------------------------------------------------------------------
31
- MODEL_ID = "gemini-2.5-pro"
32
-
33
- # -----------------------------------------------------------------------------
34
- # 2. STATE MANAGEMENT
35
- # -----------------------------------------------------------------------------
36
- if 'page' not in st.session_state: st.session_state.page = 'landing'
37
  if 'logged_in' not in st.session_state: st.session_state.logged_in = False
38
- if 'history' not in st.session_state: st.session_state.history = []
39
- if 'result' not in st.session_state: st.session_state.result = None
40
  if 'user_email' not in st.session_state: st.session_state.user_email = ""
 
41
 
42
  # -----------------------------------------------------------------------------
43
- # 3. LOGIC
44
  # -----------------------------------------------------------------------------
45
- def get_insight(input_type, content):
46
- system_instruction = (
47
- "You are Shinui, an advanced medical AI assistant. "
48
- "Analyze the input rigorously. Provide: "
49
- "1. Detailed Observation, 2. Potential Risks/Differential Diagnosis, 3. Recommended Clinical Actions. "
50
- "Maintain a highly professional, clinical tone."
51
- )
52
 
53
- try:
54
- # Initialize the specific model requested
55
- model = genai.GenerativeModel(MODEL_ID)
56
-
57
- if input_type == "Image":
58
- # The standard SDK handles [text, image] lists natively
59
- response = model.generate_content([system_instruction, content])
60
- return response.text
61
-
62
- elif input_type == "Text":
63
- full_prompt = f"{system_instruction}\n\nPatient Notes/Input: {content}"
64
- response = model.generate_content(full_prompt)
65
- return response.text
66
-
67
- except Exception as e:
68
- return f"System Error ({MODEL_ID}): {str(e)}"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
 
 
 
 
70
  def nav_to(page):
71
  st.session_state.page = page
72
  st.rerun()
73
 
74
  def sign_out():
75
  st.session_state.logged_in = False
76
- st.session_state.history = []
77
- st.session_state.result = None
78
  st.session_state.user_email = ""
79
- nav_to('landing')
 
80
 
81
- # -----------------------------------------------------------------------------
82
- # 4. UI STYLING
83
- # -----------------------------------------------------------------------------
84
- st.markdown("""
85
- <style>
86
- @import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;600;800&display=swap');
87
- .stApp { background-color: #020617; font-family: 'Plus Jakarta Sans', sans-serif; color: #f8fafc; }
88
- .shinui-card { background: rgba(30, 41, 59, 0.4); border: 1px solid rgba(148, 163, 184, 0.1); border-radius: 16px; padding: 25px; margin-bottom: 20px; }
89
- div.stButton > button { background: #38bdf8; color: #0f172a; border: none; font-weight: 700; padding: 12px 20px; border-radius: 8px; width: 100%; }
90
- h1, h2, h3 { letter-spacing: -0.02em; }
91
- #MainMenu, footer, header {visibility: hidden;}
92
- </style>
93
- """, unsafe_allow_html=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
94
 
95
  # -----------------------------------------------------------------------------
96
- # 5. PAGES
97
  # -----------------------------------------------------------------------------
98
 
99
- # --- LANDING ---
100
- def show_landing():
101
- c1, c2 = st.columns([1, 8])
102
- with c1: st.markdown("### ✨ Shinui")
103
- st.markdown("<br><br>", unsafe_allow_html=True)
104
-
105
- c1, c2 = st.columns([1.5, 1])
106
- with c1:
107
- st.markdown(f"""
108
- <h1 style='font-size: 4rem; line-height: 1.1; margin-bottom: 20px;'>
109
- Medical Intelligence.<br><span style='color:#38bdf8;'>Powered by Gemini 2.5 Pro.</span>
110
- </h1>
111
- <p style='font-size: 1.2rem; color: #94a3b8; margin-bottom: 40px;'>
112
- High-fidelity multimodal analysis for complex clinical data.
113
- </p>
114
- """, unsafe_allow_html=True)
115
- b1, b2 = st.columns([1, 2])
116
- with b1:
117
- if st.button("Sign In"): nav_to('login')
118
- with b2:
119
- if st.button("About System"): nav_to('about')
120
-
121
- with c2:
122
- st.markdown(f"""
123
- <div class='shinui-card'>
124
- <h3>🧬 Advanced Model Active</h3>
125
- <p style='color:#94a3b8;'>Engine: <code>{MODEL_ID}</code></p>
126
- <p style='color:#94a3b8; font-size: 0.9rem'>Optimized for deep reasoning & visual processing.</p>
127
- </div>
128
- """, unsafe_allow_html=True)
129
-
130
- # --- ABOUT ---
131
- def show_about():
132
- if st.button("← Back Home"): nav_to('landing')
133
- st.markdown("<br>", unsafe_allow_html=True)
134
- st.markdown(f"""
135
- <div class='shinui-card'>
136
- <h2 style='color:#38bdf8'>About Shinui</h2>
137
- <p style='font-size:1.1rem; line-height:1.6'>
138
- Shinui is configured to use the high-performance <b>{MODEL_ID}</b> model.
139
- Unlike lightweight "Flash" models, this engine is designed for complex reasoning tasks,
140
- handling intricate medical imagery and detailed clinical notes with higher accuracy.
141
- </p>
142
- <hr style='border-color:#333'>
143
- <h3>Capabilities</h3>
144
- <ul>
145
- <li><b>Deep Visual Reasoning:</b> Analyzing medical imaging with higher parameter counts.</li>
146
- <li><b>Complex Context Window:</b> Processing long-form patient histories.</li>
147
- </ul>
148
- </div>
149
- """, unsafe_allow_html=True)
150
-
151
- # --- LOGIN ---
152
- def show_login():
153
- c1, c2, c3 = st.columns([1,1,1])
154
  with c2:
155
  st.markdown("<br><br>", unsafe_allow_html=True)
156
- st.markdown("<div class='shinui-card' style='text-align:center;'><h2>Member Access</h2></div>", unsafe_allow_html=True)
157
- email = st.text_input("Email")
158
- password = st.text_input("Password", type="password")
159
- if st.button("Authenticate"):
160
- if email:
161
- st.session_state.logged_in = True
162
- st.session_state.user_email = email
163
- nav_to('dashboard')
164
- if st.button("Back"): nav_to('landing')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
165
 
166
  # --- DASHBOARD ---
167
  def show_dashboard():
 
168
  with st.sidebar:
169
  st.markdown(f"### 👤 {st.session_state.user_email}")
170
- if st.button("System Status"): nav_to('about_internal')
171
  st.markdown("---")
172
- st.write("SESSION HISTORY")
173
- if st.session_state.history:
174
- for h in reversed(st.session_state.history):
175
- st.markdown(f"<div style='font-size:0.8rem; padding:5px; border-left:2px solid #38bdf8; margin-bottom:5px;'>{h[:50]}...</div>", unsafe_allow_html=True)
 
 
 
 
 
 
 
 
 
176
  else:
177
- st.caption("No analysis performed yet.")
 
178
  st.markdown("---")
179
  if st.button("Sign Out"): sign_out()
180
 
181
- st.title(f"Shinui Interface ({MODEL_ID})")
182
- t1, t2 = st.tabs(["📷 Advanced Image Scan", "📝 Clinical Text Analysis"])
183
-
184
- with t1:
185
- st.markdown("<div class='shinui-card'>", unsafe_allow_html=True)
186
- img_file = st.file_uploader("Upload Medical Imaging", type=['png','jpg','jpeg'])
187
- if img_file and st.button("Run 2.5 Pro Analysis"):
188
- image = Image.open(img_file)
189
- st.image(image, width=300)
190
- with st.spinner(f"Running deep analysis with {MODEL_ID}..."):
191
- res = get_insight("Image", image)
192
- st.session_state.result = res
193
- st.session_state.history.append(f"Img: {res[:30]}...")
194
- st.markdown("</div>", unsafe_allow_html=True)
195
-
196
- with t2:
197
- st.markdown("<div class='shinui-card'>", unsafe_allow_html=True)
198
- txt = st.text_area("Clinical Notes / Symptoms")
199
- if txt and st.button("Run 2.5 Pro Analysis"):
200
- with st.spinner(f"Running deep analysis with {MODEL_ID}..."):
201
- res = get_insight("Text", txt)
202
- st.session_state.result = res
203
- st.session_state.history.append(f"Txt: {res[:30]}...")
204
- st.markdown("</div>", unsafe_allow_html=True)
205
-
206
- if st.session_state.result:
207
- st.markdown(f"""
208
- <div class='shinui-card' style='border-left: 5px solid #38bdf8;'>
209
- <h3 style='margin-top:0; color:#38bdf8;'>Analysis Result ({MODEL_ID})</h3>
210
- <div style='white-space: pre-wrap; color: #e2e8f0; line-height: 1.6;'>{st.session_state.result}</div>
211
- </div>
212
- """, unsafe_allow_html=True)
213
-
214
- # --- INTERNAL ABOUT ---
215
- def show_about_internal():
 
 
 
 
 
 
 
 
 
216
  with st.sidebar:
217
- if st.button("← Back"): nav_to('dashboard')
218
- st.markdown(f"""
 
219
  <div class='shinui-card'>
220
- <h2 style='color:#38bdf8'>System Status</h2>
221
- <p><b>Active Model:</b> {MODEL_ID}</p>
222
- <p><b>Library:</b> google-generativeai (Standard)</p>
223
- <p><b>Status:</b> Online</p>
 
 
 
 
 
 
 
 
224
  </div>
225
  """, unsafe_allow_html=True)
226
 
227
  # -----------------------------------------------------------------------------
228
- # 6. ROUTER
229
  # -----------------------------------------------------------------------------
230
- if st.session_state.page == 'landing': show_landing()
231
- elif st.session_state.page == 'about': show_about()
232
- elif st.session_state.page == 'login': show_login()
 
233
  elif st.session_state.page == 'dashboard':
234
  if st.session_state.logged_in: show_dashboard()
235
- else: nav_to('login')
236
- elif st.session_state.page == 'about_internal':
237
- if st.session_state.logged_in: show_about_internal()
238
- else: nav_to('login')
239
-
 
1
  import streamlit as st
2
  import os
3
+ import sqlite3
4
+ import hashlib
5
+ import google.generativeai as genai
6
  from PIL import Image
7
+ from datetime import datetime
8
 
9
  # -----------------------------------------------------------------------------
10
+ # 0. AUTO-CONFIG (FIX UPLOAD ERROR)
11
  # -----------------------------------------------------------------------------
12
  config_dir = ".streamlit"
13
  if not os.path.exists(config_dir):
 
16
  f.write("[server]\nenableXsrfProtection=false\nenableCORS=false\nmaxUploadSize=200\n")
17
 
18
  # -----------------------------------------------------------------------------
19
+ # 1. DATABASE SETUP (REAL USER SYSTEM)
20
  # -----------------------------------------------------------------------------
21
+ def init_db():
22
+ conn = sqlite3.connect('users.db')
23
+ c = conn.cursor()
24
+ # Create users table
25
+ c.execute('''CREATE TABLE IF NOT EXISTS users
26
+ (email TEXT PRIMARY KEY, password TEXT, joined_date TEXT)''')
27
+ # Create history table
28
+ c.execute('''CREATE TABLE IF NOT EXISTS history
29
+ (id INTEGER PRIMARY KEY AUTOINCREMENT, email TEXT, type TEXT, summary TEXT, date TEXT)''')
30
+ conn.commit()
31
+ conn.close()
32
+
33
+ def hash_pass(password):
34
+ return hashlib.sha256(str.encode(password)).hexdigest()
35
+
36
+ def register_user(email, password):
37
+ conn = sqlite3.connect('users.db')
38
+ c = conn.cursor()
39
+ try:
40
+ c.execute("INSERT INTO users VALUES (?, ?, ?)", (email, hash_pass(password), datetime.now().strftime("%Y-%m-%d")))
41
+ conn.commit()
42
+ return True
43
+ except sqlite3.IntegrityError:
44
+ return False
45
+ finally:
46
+ conn.close()
47
+
48
+ def login_user(email, password):
49
+ conn = sqlite3.connect('users.db')
50
+ c = conn.cursor()
51
+ c.execute("SELECT * FROM users WHERE email=? AND password=?", (email, hash_pass(password)))
52
+ data = c.fetchall()
53
+ conn.close()
54
+ return data
55
+
56
+ def add_history(email, type, summary):
57
+ conn = sqlite3.connect('users.db')
58
+ c = conn.cursor()
59
+ c.execute("INSERT INTO history (email, type, summary, date) VALUES (?, ?, ?, ?)",
60
+ (email, type, summary, datetime.now().strftime("%Y-%m-%d %H:%M")))
61
+ conn.commit()
62
+ conn.close()
63
+
64
+ def get_history(email):
65
+ conn = sqlite3.connect('users.db')
66
+ c = conn.cursor()
67
+ c.execute("SELECT type, summary, date FROM history WHERE email=? ORDER BY id DESC LIMIT 10", (email,))
68
+ data = c.fetchall()
69
+ conn.close()
70
+ return data
71
+
72
+ # Initialize DB on startup
73
+ init_db()
74
+
75
+ # -----------------------------------------------------------------------------
76
+ # 2. AI CONFIGURATION
77
+ # -----------------------------------------------------------------------------
78
+ st.set_page_config(page_title="Shinui | Medical MVP", page_icon="✨", layout="wide")
79
 
80
  GOOGLE_API_KEY = os.environ.get("GOOGLE_API_KEY")
81
  if not GOOGLE_API_KEY:
82
+ st.error("⚠️ System Error: Google API Key Missing.")
83
  st.stop()
84
 
 
85
  genai.configure(api_key=GOOGLE_API_KEY)
86
+ model = genai.GenerativeModel('gemini-1.5-flash')
87
 
88
  # -----------------------------------------------------------------------------
89
+ # 3. STATE MANAGEMENT
90
  # -----------------------------------------------------------------------------
91
+ if 'page' not in st.session_state: st.session_state.page = 'auth'
 
 
 
 
 
92
  if 'logged_in' not in st.session_state: st.session_state.logged_in = False
 
 
93
  if 'user_email' not in st.session_state: st.session_state.user_email = ""
94
+ if 'current_result' not in st.session_state: st.session_state.current_result = None
95
 
96
  # -----------------------------------------------------------------------------
97
+ # 4. UI STYLING (PROFESSIONAL DARK MODE)
98
  # -----------------------------------------------------------------------------
99
+ st.markdown("""
100
+ <style>
101
+ @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;800&display=swap');
 
 
 
 
102
 
103
+ .stApp {
104
+ background-color: #0f172a;
105
+ font-family: 'Inter', sans-serif;
106
+ color: #f8fafc;
107
+ }
108
+
109
+ /* Cards */
110
+ .shinui-card {
111
+ background: #1e293b;
112
+ border: 1px solid #334155;
113
+ border-radius: 12px;
114
+ padding: 24px;
115
+ margin-bottom: 20px;
116
+ box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
117
+ }
118
+
119
+ /* Buttons */
120
+ div.stButton > button {
121
+ background-color: #3b82f6;
122
+ color: white;
123
+ border-radius: 8px;
124
+ padding: 10px 24px;
125
+ font-weight: 600;
126
+ border: none;
127
+ width: 100%;
128
+ transition: all 0.2s;
129
+ }
130
+ div.stButton > button:hover {
131
+ background-color: #2563eb;
132
+ }
133
+
134
+ /* Results */
135
+ .result-section {
136
+ padding: 15px;
137
+ border-left: 4px solid #3b82f6;
138
+ background: rgba(59, 130, 246, 0.1);
139
+ margin-bottom: 10px;
140
+ border-radius: 0 8px 8px 0;
141
+ }
142
+
143
+ /* Inputs */
144
+ .stTextInput input {
145
+ background-color: #334155;
146
+ color: white;
147
+ border: 1px solid #475569;
148
+ }
149
+
150
+ #MainMenu, footer, header {visibility: hidden;}
151
+ </style>
152
+ """, unsafe_allow_html=True)
153
 
154
+ # -----------------------------------------------------------------------------
155
+ # 5. LOGIC FUNCTIONS
156
+ # -----------------------------------------------------------------------------
157
  def nav_to(page):
158
  st.session_state.page = page
159
  st.rerun()
160
 
161
  def sign_out():
162
  st.session_state.logged_in = False
 
 
163
  st.session_state.user_email = ""
164
+ st.session_state.current_result = None
165
+ nav_to('auth')
166
 
167
+ def get_gemini_insight(input_type, content):
168
+ # Detailed MVP System Prompt
169
+ prompt = """
170
+ You are Shinui, a professional medical AI assistant.
171
+ Analyze the input carefully.
172
+ Format your response using these EXACT headers:
173
+
174
+ ### 1. Clinical Observation
175
+ (Describe what you see or read clearly)
176
+
177
+ ### 2. Potential Risks
178
+ (List potential conditions or risks associated)
179
+
180
+ ### 3. Recommended Actions
181
+ (Suggest next steps, e.g., see a specialist, apply ice, etc.)
182
+ """
183
+
184
+ try:
185
+ if input_type == "Image":
186
+ response = model.generate_content([prompt, content])
187
+ return response.text
188
+ elif input_type == "Text":
189
+ response = model.generate_content(f"{prompt}\n\nInput Data: {content}")
190
+ return response.text
191
+ except Exception as e:
192
+ return f"Error: {str(e)}"
193
 
194
  # -----------------------------------------------------------------------------
195
+ # 6. PAGES
196
  # -----------------------------------------------------------------------------
197
 
198
+ # --- AUTH PAGE (LOGIN / REGISTER) ---
199
+ def show_auth():
200
+ c1, c2, c3 = st.columns([1, 2, 1])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
201
  with c2:
202
  st.markdown("<br><br>", unsafe_allow_html=True)
203
+ st.markdown("<h1 style='text-align:center; color:#3b82f6;'>✨ Shinui</h1>", unsafe_allow_html=True)
204
+ st.markdown("<p style='text-align:center; color:#94a3b8;'>Intelligent Medical Analysis MVP</p>", unsafe_allow_html=True)
205
+
206
+ tab1, tab2 = st.tabs(["Sign In", "Create Account"])
207
+
208
+ with tab1:
209
+ st.markdown("<div class='shinui-card'>", unsafe_allow_html=True)
210
+ email = st.text_input("Email Address", key="l_email")
211
+ password = st.text_input("Password", type="password", key="l_pass")
212
+ if st.button("Login"):
213
+ if login_user(email, password):
214
+ st.session_state.logged_in = True
215
+ st.session_state.user_email = email
216
+ st.success("Login Successful")
217
+ time.sleep(0.5) # Smooth transition
218
+ nav_to('dashboard')
219
+ else:
220
+ st.error("Invalid email or password")
221
+ st.markdown("</div>", unsafe_allow_html=True)
222
+
223
+ with tab2:
224
+ st.markdown("<div class='shinui-card'>", unsafe_allow_html=True)
225
+ new_email = st.text_input("Email Address", key="r_email")
226
+ new_pass = st.text_input("Password", type="password", key="r_pass")
227
+ confirm_pass = st.text_input("Confirm Password", type="password", key="r_pass2")
228
+ if st.button("Register"):
229
+ if new_pass != confirm_pass:
230
+ st.error("Passwords do not match")
231
+ elif register_user(new_email, new_pass):
232
+ st.success("Account created! Please log in.")
233
+ else:
234
+ st.error("Email already exists")
235
+ st.markdown("</div>", unsafe_allow_html=True)
236
 
237
  # --- DASHBOARD ---
238
  def show_dashboard():
239
+ # SIDEBAR NAVIGATION
240
  with st.sidebar:
241
  st.markdown(f"### 👤 {st.session_state.user_email}")
242
+ st.markdown("<span style='color:#22c55e; font-size:0.8rem;'>● Online</span>", unsafe_allow_html=True)
243
  st.markdown("---")
244
+
245
+ if st.button("📊 Dashboard"): nav_to('dashboard')
246
+ if st.button("ℹ️ About Shinui"): nav_to('about')
247
+
248
+ st.markdown("### Recent History")
249
+ history = get_history(st.session_state.user_email)
250
+ if history:
251
+ for h_type, h_sum, h_date in history:
252
+ st.markdown(f"""
253
+ <div style='font-size:0.8rem; padding:8px; background:#334155; border-radius:6px; margin-bottom:6px;'>
254
+ <b>{h_type}</b><br>{h_date}<br><span style='color:#94a3b8'>{h_sum[:40]}...</span>
255
+ </div>
256
+ """, unsafe_allow_html=True)
257
  else:
258
+ st.caption("No activity found.")
259
+
260
  st.markdown("---")
261
  if st.button("Sign Out"): sign_out()
262
 
263
+ # MAIN CONTENT
264
+ st.title("Medical Analysis Dashboard")
265
+
266
+ col1, col2 = st.columns([2, 1])
267
+ with col1:
268
+ st.markdown("### New Scan")
269
+ t1, t2 = st.tabs(["📷 Visual Analysis", "📝 Symptom Check"])
270
+
271
+ with t1:
272
+ st.markdown("<div class='shinui-card'>", unsafe_allow_html=True)
273
+ img = st.file_uploader("Upload Medical Image", type=['png','jpg','jpeg'])
274
+ if img and st.button("Analyze Image"):
275
+ image = Image.open(img)
276
+ with st.spinner("Shinui AI Analyzing..."):
277
+ res = get_gemini_insight("Image", image)
278
+ st.session_state.current_result = res
279
+ # Save detailed result to DB
280
+ add_history(st.session_state.user_email, "Visual Scan", res[:100].replace('\n', ' '))
281
+
282
+ with t2:
283
+ st.markdown("<div class='shinui-card'>", unsafe_allow_html=True)
284
+ txt = st.text_area("Describe Symptoms")
285
+ if txt and st.button("Analyze Text"):
286
+ with st.spinner("Shinui AI Analyzing..."):
287
+ res = get_gemini_insight("Text", txt)
288
+ st.session_state.current_result = res
289
+ add_history(st.session_state.user_email, "Text Analysis", res[:100].replace('\n', ' '))
290
+
291
+ # RESULTS SECTION (Right Side / Bottom)
292
+ with col2:
293
+ st.markdown("### Results")
294
+ if st.session_state.current_result:
295
+ # Parsing Markdown for pretty display
296
+ content = st.session_state.current_result
297
+ st.markdown(f"""
298
+ <div class='shinui-card' style='border-top: 4px solid #3b82f6;'>
299
+ {content}
300
+ </div>
301
+ """, unsafe_allow_html=True)
302
+ else:
303
+ st.info("Upload an image or enter text to see analysis results here.")
304
+
305
+ # --- ABOUT PAGE ---
306
+ def show_about():
307
  with st.sidebar:
308
+ if st.button("← Back to Dashboard"): nav_to('dashboard')
309
+
310
+ st.markdown("""
311
  <div class='shinui-card'>
312
+ <h2 style='color:#3b82f6'>About Shinui</h2>
313
+ <p style='font-size:1.1rem; line-height:1.6'>
314
+ Shinui is an MVP-stage medical intelligence platform designed to democratize access to health data analysis.
315
+ </p>
316
+ <hr style='border-color:#334155'>
317
+ <h3>The Problem</h3>
318
+ <p>Medical data is complex, jargon-heavy, and hard for patients to interpret.</p>
319
+ <h3>The Solution</h3>
320
+ <p>Shinui uses Google's Gemini 1.5 Flash model to act as a translator, turning images and clinical notes into actionable, understandable insights.</p>
321
+ <h3>Version Info</h3>
322
+ <p><b>Build:</b> v1.0 MVP</p>
323
+ <p><b>Engine:</b> Gemini 1.5 Flash</p>
324
  </div>
325
  """, unsafe_allow_html=True)
326
 
327
  # -----------------------------------------------------------------------------
328
+ # 7. ROUTER
329
  # -----------------------------------------------------------------------------
330
+ import time # Import needed for sleep
331
+
332
+ if st.session_state.page == 'auth':
333
+ show_auth()
334
  elif st.session_state.page == 'dashboard':
335
  if st.session_state.logged_in: show_dashboard()
336
+ else: nav_to('auth')
337
+ elif st.session_state.page == 'about':
338
+ if st.session_state.logged_in: show_about()
339
+ else: nav_to('auth')