--- title: Delay Predictor emoji: 🚀 colorFrom: indigo colorTo: indigo sdk: docker app_port: 8501 tags: - streamlit - distilbart - project-delay pinned: false short_description: Streamlit app for project delay prediction using DistilBART --- # Project Delay Predictor This Streamlit app predicts project delays based on task data, workforce, and weather conditions, using DistilBART (`sshleifer/distilbart-cnn-6-6`) for AI-generated insights. It runs on the free CPU tier of Hugging Face Spaces, generating delay probabilities, insights, and a downloadable PDF report, with integration to Salesforce. ## Features - Input project details via a Streamlit interface. - Predict delay probability and generate AI insights. - Visualize delay risk with an interactive Chart.js heatmap. - Save results and PDF to Salesforce. - Download a PDF report. ## Setup 1. Ensure Salesforce credentials are set as environment variables (`SF_USERNAME`, `SF_PASSWORD`, `SF_SECURITY_TOKEN`, `SF_INSTANCE_URL`). 2. Deploy on a Hugging Face Space with the free CPU tier. 3. Access the app at the Space's URL. ## Notes - Uses DistilBART for CPU-friendly inference (~5-10 seconds per prediction). - Secure model loading with `safetensors` and `trust_remote_code=False`. - Includes logging for debugging and rule-based fallback insights if the model fails. ## Troubleshooting - **AI Insights Unavailable**: Check Space logs for errors (e.g., memory issues, network failures). Restart the Space or reduce `max_new_tokens` in `model.py`. - **Slow Inference**: CPU inference may take ~5-10 seconds. Consider switching to `t5-small` for faster performance. - **Dependency Errors**: Ensure all dependencies in `requirements.txt` are installed correctly. For questions, refer to [Streamlit documentation](https://docs.streamlit.io) or [Hugging Face forums](https://discuss.huggingface.co).