Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -13,6 +13,7 @@ from io import BytesIO
|
|
| 13 |
from simple_salesforce import Salesforce
|
| 14 |
import base64
|
| 15 |
import logging
|
|
|
|
| 16 |
|
| 17 |
# Configure logging
|
| 18 |
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
|
|
@@ -247,7 +248,17 @@ if submit_button:
|
|
| 247 |
|
| 248 |
# Generate Chart.js heatmap
|
| 249 |
chart_config = generate_heatmap(prediction['delay_probability'], f"{phase}: {task}")
|
| 250 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 251 |
|
| 252 |
# Generate matplotlib figure for PDF
|
| 253 |
fig, ax = plt.subplots(figsize=(8, 2))
|
|
|
|
| 13 |
from simple_salesforce import Salesforce
|
| 14 |
import base64
|
| 15 |
import logging
|
| 16 |
+
import json
|
| 17 |
|
| 18 |
# Configure logging
|
| 19 |
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
|
|
|
|
| 248 |
|
| 249 |
# Generate Chart.js heatmap
|
| 250 |
chart_config = generate_heatmap(prediction['delay_probability'], f"{phase}: {task}")
|
| 251 |
+
chart_id = f"chart-{hash(str(chart_config))}"
|
| 252 |
+
chart_html = f"""
|
| 253 |
+
<canvas id="{chart_id}" style="max-height: 200px; max-width: 600px;"></canvas>
|
| 254 |
+
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
| 255 |
+
<script>
|
| 256 |
+
const ctx = document.getElementById('{chart_id}').getContext('2d');
|
| 257 |
+
new Chart(ctx, {json.dumps(chart_config)});
|
| 258 |
+
</script>
|
| 259 |
+
"""
|
| 260 |
+
st.markdown(chart_html, unsafe_allow_html=True)
|
| 261 |
+
logger.info("Chart.js heatmap rendered")
|
| 262 |
|
| 263 |
# Generate matplotlib figure for PDF
|
| 264 |
fig, ax = plt.subplots(figsize=(8, 2))
|