66from datetime import datetime
77import os
88
9- FASTAPI_URL = os .getenv ("API_URL" , "https://mlops-drift-detector.onrender.com" )
9+ FASTAPI_URL = os .getenv ("API_URL" , "https://mlops-drift-detector.onrender.com" ) # for deployment
10+ # FASTAPI_URL = os.getenv("API_URL", "http://127.0.0.1:8000")
1011
1112st .set_page_config (
1213 page_title = "MLOps Drift Monitor" ,
13- page_icon = "📊 " ,
14+ page_icon = "" ,
1415 layout = "wide"
1516)
1617
3031 </style>
3132""" , unsafe_allow_html = True )
3233
33- st .title ("📊 Model Drift Monitoring Dashboard" )
34+ st .title ("Model Drift Monitoring Dashboard" )
3435st .markdown ("---" )
3536
3637# Sidebar
3738with st .sidebar :
38- st .header ("⚙️ Configuration" )
39+ st .header ("Configuration" )
3940
4041 # API Connection
4142 st .subheader ("API Connection" )
4243 api_url = st .text_input ("API URL" , value = FASTAPI_URL )
4344
4445 # Test connection
45- if st .button ("🔄 Test Connection" ):
46+ if st .button ("Test Connection" ):
4647 try :
4748 response = requests .get (f"{ api_url } /healthz" , timeout = 5 )
4849 if response .status_code == 200 :
49- st .success ("✅ Connected to API" )
50+ st .success ("Connected to API" )
5051 else :
51- st .error (f"❌ API returned status { response .status_code } " )
52+ st .error (f"API returned status { response .status_code } " )
5253 except Exception as e :
53- st .error (f"❌ Cannot connect to API: { str (e )} " )
54+ st .error (f"Cannot connect to API: { str (e )} " )
5455
5556 st .markdown ("---" )
5657
6263 st .markdown ("---" )
6364
6465 # Info
65- st .subheader ("ℹ️ About " )
66+ st .subheader ("ℹAbout " )
6667 st .markdown ("""
6768 This dashboard monitors concept drift in real-time.
6869 - **Drift Score**: 0-1 scale
@@ -93,7 +94,7 @@ def fetch_drift():
9394 st .error (f"API Error: { resp .status_code } " )
9495 return None
9596 except requests .exceptions .ConnectionError :
96- st .error ("❌ Cannot connect to API. Make sure the server is running." )
97+ st .error ("Cannot connect to API. Make sure the server is running." )
9798 return None
9899 except Exception as e :
99100 st .error (f"Error: { str (e )} " )
@@ -160,15 +161,15 @@ def fetch_stats():
160161 )
161162
162163 with col3 :
163- status = "⚠️ DRIFT" if alert else "✅ NORMAL"
164+ status = "⚠️ DRIFT" if alert else "NORMAL"
164165 status_placeholder .metric ("System Status" , status )
165166
166167 # Alert
167168 if alert and not st .session_state .last_alert :
168- alert_placeholder .error ("🚨 **DRIFT DETECTED!** Check Discord for alerts." )
169+ alert_placeholder .error ("**DRIFT DETECTED!** Check Discord for alerts." )
169170 st .session_state .last_alert = True
170171 elif not alert :
171- alert_placeholder .success ("✅ System normal - No drift detected" )
172+ alert_placeholder .success ("System normal - No drift detected" )
172173 st .session_state .last_alert = False
173174
174175 # Plot drift history
@@ -219,7 +220,7 @@ def fetch_stats():
219220
220221 # Display statistics
221222 if stats :
222- st .subheader ("📈 Prediction Statistics" )
223+ st .subheader ("Prediction Statistics" )
223224 col_a , col_b , col_c = st .columns (3 )
224225
225226 with col_a :
@@ -244,7 +245,7 @@ def fetch_stats():
244245
245246 else :
246247 # Show connection error
247- drift_placeholder .error ("⚠️ Waiting for API connection..." )
248+ drift_placeholder .error ("Waiting for API connection..." )
248249
249250 # Wait before next refresh
250251 time .sleep (refresh_rate )
0 commit comments