AjaykumarPilla commited on
Commit
45af9b4
·
verified ·
1 Parent(s): 165f66d

Delete app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -93
app.py DELETED
@@ -1,93 +0,0 @@
1
- import streamlit as st
2
- import pandas as pd
3
- import matplotlib.pyplot as plt
4
- from datetime import datetime
5
- from model import predict_delay
6
- from utils import validate_inputs, generate_heatmap
7
-
8
- # Streamlit app configuration
9
- st.set_page_config(page_title="Delay 🚀", layout="wide")
10
-
11
- # Title
12
- st.title("Project Delay Predictor 🚀")
13
-
14
- # Task options per phase
15
- task_options = {
16
- "Planning": ["Define Scope", "Resource Allocation", "Permit Acquisition"],
17
- "Design": ["Architectural Drafting", "Engineering Analysis", "Design Review"],
18
- "Construction": ["Foundation Work", "Structural Build", "Utility Installation"]
19
- }
20
-
21
- # Input form
22
- with st.form("project_form"):
23
- col1, col2 = st.columns(2)
24
-
25
- with col1:
26
- project_name = st.text_input("Project Name")
27
- phase = st.selectbox("Phase", [""] + ["Planning", "Design", "Construction"], index=0)
28
- task = st.selectbox("Task", [""] + (task_options.get(phase, []) if phase else []), index=0)
29
- current_progress = st.number_input("Current Progress (%)", min_value=0.0, max_value=100.0, step=1.0)
30
- task_expected_duration = st.number_input("Task Expected Duration (days)", min_value=0, step=1)
31
- task_actual_duration = st.number_input("Task Actual Duration (days)", min_value=0, step=1)
32
-
33
- with col2:
34
- workforce_gap = st.number_input("Workforce Gap (%)", min_value=0.0, max_value=100.0, step=1.0)
35
- workforce_skill_level = st.selectbox("Workforce Skill Level", ["Low", "Medium", "High"], index=1)
36
- workforce_shift_hours = st.number_input("Workforce Shift Hours", min_value=0, step=1)
37
- weather_impact_score = st.number_input("Weather Impact Score (0-100)", min_value=0, max_value=100, step=1)
38
- weather_condition = st.text_input("Weather Condition (e.g., Rain)")
39
- weather_forecast_date = st.date_input("Weather Forecast Date", min_value=datetime(2025, 1, 1))
40
-
41
- submit_button = st.form_submit_button("Predict Delay")
42
- pdf_button = st.form_submit_button("Generate PDF Report")
43
-
44
- # Process form submission
45
- if submit_button:
46
- # Prepare input data
47
- input_data = {
48
- "project_name": project_name,
49
- "phase": phase,
50
- "task": task,
51
- "current_progress": current_progress,
52
- "task_expected_duration": task_expected_duration,
53
- "task_actual_duration": task_actual_duration,
54
- "workforce_gap": workforce_gap,
55
- "workforce_skill_level": workforce_skill_level,
56
- "workforce_shift_hours": workforce_shift_hours,
57
- "weather_impact_score": weather_impact_score,
58
- "weather_condition": weather_condition,
59
- "weather_forecast_date": weather_forecast_date.strftime("%Y-%m-%d")
60
- }
61
-
62
- # Validate inputs
63
- error = validate_inputs(input_data)
64
- if error:
65
- st.error(error)
66
- else:
67
- # Get prediction
68
- with st.spinner("Predicting..."):
69
- prediction = predict_delay(input_data)
70
-
71
- if "error" in prediction:
72
- st.error(prediction["error"])
73
- else:
74
- # Display results
75
- st.subheader("Prediction Results")
76
- st.write(f"**Delay Probability**: {prediction['delay_probability']:.2f}%")
77
- st.write(f"**High Risk Phases**: {prediction['high_risk_phases']}")
78
- st.write(f"**AI Insights**: {prediction['ai_insights']}")
79
-
80
- # Generate and display heatmap
81
- fig = generate_heatmap(prediction['delay_probability'], f"{phase}: {task}")
82
- st.pyplot(fig)
83
-
84
- # Store prediction in session state for PDF
85
- st.session_state.prediction = prediction
86
- st.session_state.input_data = input_data
87
-
88
- # Generate PDF report
89
- if pdf_button:
90
- if 'prediction' not in st.session_state:
91
- st.error("Generate a prediction first")
92
- else:
93
- st.write("PDF generation is not fully implemented in this demo. Use browser print functionality as a workaround.")