Sanjayraju30's picture
Update app.py
56dec78 verified
# 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()