File size: 1,005 Bytes
02048bf
 
 
38339ed
 
02048bf
dede043
bb95304
 
 
 
02048bf
 
 
38339ed
02048bf
dede043
 
 
02048bf
dede043
 
 
 
 
 
 
 
 
02048bf
38339ed
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# app.py

import streamlit as st
from modules.huggingface_inference import predict_alerts
from modules.data_view import show_raw_data, show_predictions, show_status

# Salesforce + Hugging Face config (fill in your values)
SF_USERNAME = "[email protected]"
SF_PASSWORD = "Vedavathi@04"
SF_SECURITY_TOKEN = "jqe4His8AcuFJucZz5NBHfGU"
HF_API_URL = "https://ap [email protected]/models/your-hf-model"
HF_API_TOKEN = "hf_your_token"

def main():
    st.title("📡 Hugging Face + Salesforce Smart Pole Monitor")

    try:
        sf = connect_salesforce(SF_USERNAME, SF_PASSWORD, SF_SECURITY_TOKEN)
        df = fetch_pole_data(sf)

        if not df.empty:
            show_raw_data(df)
            df = predict_alerts(df, HF_API_URL, HF_API_TOKEN)
            show_status()
            show_predictions(df)
        else:
            st.warning("No data fetched from Salesforce.")
    except Exception as e:
        st.error(f"Error: {e}")

if __name__ == "__main__":
    main()