Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -28,7 +28,7 @@ def generate_plot(planned_cost_inr, actual_spend_inr, forecast_cost_inr):
|
|
| 28 |
categories = ['Planned Cost', 'Actual Spend', 'Forecasted Cost']
|
| 29 |
values = [planned_cost_inr, actual_spend_inr, forecast_cost_inr]
|
| 30 |
bars = ax.bar(categories, values, color=['#1f77b4', '#ff7f0e', '#2ca02c'])
|
| 31 |
-
ax.set_title("Budget
|
| 32 |
ax.set_ylabel("Amount (₹)", fontsize=12)
|
| 33 |
ax.tick_params(axis='x', rotation=45)
|
| 34 |
ax.grid(True, axis='y', linestyle='--', alpha=0.7)
|
|
@@ -134,7 +134,7 @@ def predict_risk(planned_cost_inr, actual_spend_inr, category, cement_index, lab
|
|
| 134 |
logger.debug(f"Starting prediction with inputs: planned_cost_inr={planned_cost_inr}, actual_spend_inr={actual_spend_inr}, "
|
| 135 |
f"category={category}, cement_index={cement_index}, labor_index={labor_index}, project_phase={project_phase}")
|
| 136 |
|
| 137 |
-
#
|
| 138 |
total_risk = 1 if actual_spend_inr > planned_cost_inr else 0
|
| 139 |
risk_percentage = total_risk * 100 # Convert to percentage (0% or 100%)
|
| 140 |
forecast_cost_inr = planned_cost_inr * 2
|
|
@@ -181,7 +181,7 @@ def predict_risk(planned_cost_inr, actual_spend_inr, category, cement_index, lab
|
|
| 181 |
f"[Chart displayed below]\n\n"
|
| 182 |
f"Detailed Metrics\n"
|
| 183 |
f"----------------------------------------\n"
|
| 184 |
-
f"Total Risk: {
|
| 185 |
f"Planned Cost: ₹{planned_cost_inr:,.2f}\n"
|
| 186 |
f"Actual Spend: ₹{actual_spend_inr:,.2f}\n"
|
| 187 |
f"Forecasted Cost: ₹{forecast_cost_inr:,.2f}\n"
|
|
|
|
| 28 |
categories = ['Planned Cost', 'Actual Spend', 'Forecasted Cost']
|
| 29 |
values = [planned_cost_inr, actual_spend_inr, forecast_cost_inr]
|
| 30 |
bars = ax.bar(categories, values, color=['#1f77b4', '#ff7f0e', '#2ca02c'])
|
| 31 |
+
ax.set_title("Budget Overrun Risk", fontsize=14, pad=15)
|
| 32 |
ax.set_ylabel("Amount (₹)", fontsize=12)
|
| 33 |
ax.tick_params(axis='x', rotation=45)
|
| 34 |
ax.grid(True, axis='y', linestyle='--', alpha=0.7)
|
|
|
|
| 134 |
logger.debug(f"Starting prediction with inputs: planned_cost_inr={planned_cost_inr}, actual_spend_inr={actual_spend_inr}, "
|
| 135 |
f"category={category}, cement_index={cement_index}, labor_index={labor_index}, project_phase={project_phase}")
|
| 136 |
|
| 137 |
+
# Placeholder for risk calculation logic (simplified for demo)
|
| 138 |
total_risk = 1 if actual_spend_inr > planned_cost_inr else 0
|
| 139 |
risk_percentage = total_risk * 100 # Convert to percentage (0% or 100%)
|
| 140 |
forecast_cost_inr = planned_cost_inr * 2
|
|
|
|
| 181 |
f"[Chart displayed below]\n\n"
|
| 182 |
f"Detailed Metrics\n"
|
| 183 |
f"----------------------------------------\n"
|
| 184 |
+
f"Total Risk: {total_risk}\n"
|
| 185 |
f"Planned Cost: ₹{planned_cost_inr:,.2f}\n"
|
| 186 |
f"Actual Spend: ₹{actual_spend_inr:,.2f}\n"
|
| 187 |
f"Forecasted Cost: ₹{forecast_cost_inr:,.2f}\n"
|