Spaces:
Sleeping
Sleeping
File size: 1,053 Bytes
02048bf 38339ed 02048bf dede043 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 34 |
# app.py
import streamlit as st
from modules.salesforce_connector import connect_salesforce, fetch_pole_data
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 = "your_username"
SF_PASSWORD = "your_password"
SF_SECURITY_TOKEN = "your_security_token"
HF_API_URL = "https://api-inference.huggingface.co/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()
|