File size: 1,865 Bytes
ff8a26e
64f83b4
ff8a26e
6fa77c1
4a470ac
ff8a26e
 
 
21c1612
64f83b4
 
ff8a26e
64f83b4
ff8a26e
 
64f83b4
ff8a26e
64f83b4
ff8a26e
64f83b4
 
 
16e4c0c
64f83b4
 
 
 
 
 
 
 
 
 
 
16e4c0c
 
 
 
 
 
64f83b4
 
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
35
36
37
38
39
40
41
42
---
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).