Sanjayraju30 commited on
Commit
dede043
·
verified ·
1 Parent(s): 38339ed

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -20
app.py CHANGED
@@ -5,32 +5,29 @@ from modules.salesforce_connector import connect_salesforce, fetch_pole_data
5
  from modules.huggingface_inference import predict_alerts
6
  from modules.data_view import show_raw_data, show_predictions, show_status
7
 
8
- # ---------------------- CONFIG ----------------------
9
- SF_USERNAME = "[email protected]"
10
- SF_PASSWORD = "Vedavathi@04"
11
- SF_SECURITY_TOKEN = "jqe4His8AcuFJucZz5NBHfGU"
12
- HF_API_URL = "https://api-inference.huggingface.co/models/your-model"
13
  HF_API_TOKEN = "hf_your_token"
14
 
15
- # ---------------------- MAIN ----------------------
16
  def main():
17
  st.title("📡 Hugging Face + Salesforce Smart Pole Monitor")
18
 
19
- sf = connect_salesforce(SF_USERNAME, SF_PASSWORD, SF_SECURITY_TOKEN)
20
- df = fetch_pole_data(sf)
 
21
 
22
- if not df.empty:
23
- show_raw_data(df)
24
- df = predict_alerts(df, HF_API_URL, HF_API_TOKEN)
25
- show_status()
26
- show_predictions(df)
27
- else:
28
- st.warning("No data fetched from Salesforce.")
 
 
29
 
30
  if __name__ == "__main__":
31
  main()
32
-
33
-
34
-
35
-
36
-
 
5
  from modules.huggingface_inference import predict_alerts
6
  from modules.data_view import show_raw_data, show_predictions, show_status
7
 
8
+ # Salesforce + Hugging Face config (fill in your values)
9
+ SF_USERNAME = "your_username"
10
+ SF_PASSWORD = "your_password"
11
+ SF_SECURITY_TOKEN = "your_security_token"
12
+ HF_API_URL = "https://api-inference.huggingface.co/models/your-hf-model"
13
  HF_API_TOKEN = "hf_your_token"
14
 
 
15
  def main():
16
  st.title("📡 Hugging Face + Salesforce Smart Pole Monitor")
17
 
18
+ try:
19
+ sf = connect_salesforce(SF_USERNAME, SF_PASSWORD, SF_SECURITY_TOKEN)
20
+ df = fetch_pole_data(sf)
21
 
22
+ if not df.empty:
23
+ show_raw_data(df)
24
+ df = predict_alerts(df, HF_API_URL, HF_API_TOKEN)
25
+ show_status()
26
+ show_predictions(df)
27
+ else:
28
+ st.warning("No data fetched from Salesforce.")
29
+ except Exception as e:
30
+ st.error(f"Error: {e}")
31
 
32
  if __name__ == "__main__":
33
  main()