Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -64,6 +64,23 @@ st.markdown("""
|
|
| 64 |
display: flex;
|
| 65 |
gap: 10px;
|
| 66 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
</style>
|
| 68 |
""", unsafe_allow_html=True)
|
| 69 |
|
|
@@ -93,6 +110,7 @@ def get_groq_provider():
|
|
| 93 |
# Charger le fichier Excel avec le plan d'action
|
| 94 |
def load_action_plan(uploaded_file):
|
| 95 |
try:
|
|
|
|
| 96 |
action_plan_df = pd.read_excel(uploaded_file, header=11)
|
| 97 |
action_plan_df = action_plan_df[["requirementNo", "requirementText", "requirementExplanation"]]
|
| 98 |
action_plan_df.columns = ["Numéro d'exigence", "Exigence IFS Food 8", "Explication (par l'auditeur/l'évaluateur)"]
|
|
@@ -100,6 +118,10 @@ def load_action_plan(uploaded_file):
|
|
| 100 |
# Ajouter une colonne de statut
|
| 101 |
action_plan_df["Statut"] = "Non traité"
|
| 102 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
return action_plan_df
|
| 104 |
except Exception as e:
|
| 105 |
st.error(f"⚠️ Erreur lors de la lecture du fichier: {str(e)}")
|
|
@@ -535,7 +557,10 @@ def main():
|
|
| 535 |
if index == st.session_state.get('active_item') or index in st.session_state.get('recommendations', {}):
|
| 536 |
if index in st.session_state.get('recommendations', {}):
|
| 537 |
with st.expander("📋 Recommandation IA", expanded=True if index == st.session_state.get('active_item') else False):
|
|
|
|
|
|
|
| 538 |
st.markdown(st.session_state['recommendations'][index])
|
|
|
|
| 539 |
|
| 540 |
if st.button("✅ Marquer comme complété", key=f"complete_{index}"):
|
| 541 |
st.session_state['action_plan_df'].loc[index, "Statut"] = "Complété"
|
|
|
|
| 64 |
display: flex;
|
| 65 |
gap: 10px;
|
| 66 |
}
|
| 67 |
+
|
| 68 |
+
/* Style personnalisé pour les expanders de recommandation */
|
| 69 |
+
.recommendation-expander {
|
| 70 |
+
background-color: #e6f2ff !important;
|
| 71 |
+
border-radius: 8px !important;
|
| 72 |
+
border: 1px solid #b3d9ff !important;
|
| 73 |
+
margin-top: 10px !important;
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
/* Modification du style des éléments d'expander de Streamlit */
|
| 77 |
+
.st-emotion-cache-1abe2ax, .st-emotion-cache-ue6h4q, .st-emotion-cache-1y4p8pa {
|
| 78 |
+
background-color: #e6f2ff !important;
|
| 79 |
+
}
|
| 80 |
+
/* Modification pour le header d'expander */
|
| 81 |
+
.st-emotion-cache-19rxjzo {
|
| 82 |
+
background-color: #cce5ff !important;
|
| 83 |
+
}
|
| 84 |
</style>
|
| 85 |
""", unsafe_allow_html=True)
|
| 86 |
|
|
|
|
| 110 |
# Charger le fichier Excel avec le plan d'action
|
| 111 |
def load_action_plan(uploaded_file):
|
| 112 |
try:
|
| 113 |
+
# Utiliser header=11 pour sauter les lignes d'en-tête
|
| 114 |
action_plan_df = pd.read_excel(uploaded_file, header=11)
|
| 115 |
action_plan_df = action_plan_df[["requirementNo", "requirementText", "requirementExplanation"]]
|
| 116 |
action_plan_df.columns = ["Numéro d'exigence", "Exigence IFS Food 8", "Explication (par l'auditeur/l'évaluateur)"]
|
|
|
|
| 118 |
# Ajouter une colonne de statut
|
| 119 |
action_plan_df["Statut"] = "Non traité"
|
| 120 |
|
| 121 |
+
# Supprimer les lignes vides (où le numéro d'exigence est NaN ou vide)
|
| 122 |
+
action_plan_df = action_plan_df.dropna(subset=["Numéro d'exigence"])
|
| 123 |
+
action_plan_df = action_plan_df[action_plan_df["Numéro d'exigence"].astype(str).str.strip() != ""]
|
| 124 |
+
|
| 125 |
return action_plan_df
|
| 126 |
except Exception as e:
|
| 127 |
st.error(f"⚠️ Erreur lors de la lecture du fichier: {str(e)}")
|
|
|
|
| 557 |
if index == st.session_state.get('active_item') or index in st.session_state.get('recommendations', {}):
|
| 558 |
if index in st.session_state.get('recommendations', {}):
|
| 559 |
with st.expander("📋 Recommandation IA", expanded=True if index == st.session_state.get('active_item') else False):
|
| 560 |
+
# Appliquer la classe personnalisée à l'expander via HTML
|
| 561 |
+
st.markdown('<div class="recommendation-expander">', unsafe_allow_html=True)
|
| 562 |
st.markdown(st.session_state['recommendations'][index])
|
| 563 |
+
st.markdown('</div>', unsafe_allow_html=True)
|
| 564 |
|
| 565 |
if st.button("✅ Marquer comme complété", key=f"complete_{index}"):
|
| 566 |
st.session_state['action_plan_df'].loc[index, "Statut"] = "Complété"
|