Fix: pin huggingface_hub==0.24.7 + fix f-string syntax
Browse files- app.py +16 -8
- requirements.txt +1 -1
app.py
CHANGED
|
@@ -344,15 +344,22 @@ def get_attack_stats(attack_path: Dict[str, Any], language: str = "en") -> str:
|
|
| 344 |
|
| 345 |
phase_labels = PHASE_LABELS_FR if language == "fr" else PHASE_LABELS_EN
|
| 346 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 347 |
stats = f"""
|
| 348 |
-
**{
|
| 349 |
|
| 350 |
-
- **{
|
| 351 |
-
- **{
|
| 352 |
-
- **{
|
| 353 |
-
- **{
|
| 354 |
|
| 355 |
-
**{
|
| 356 |
"""
|
| 357 |
|
| 358 |
for phase in sorted(unique_phases):
|
|
@@ -392,7 +399,7 @@ def create_phase_breakdown(attack_path: Dict[str, Any], language: str = "en") ->
|
|
| 392 |
])
|
| 393 |
|
| 394 |
fig.update_layout(
|
| 395 |
-
title=
|
| 396 |
xaxis_title=f"{'MITRE Phase' if language == 'en' else 'Phase MITRE'}",
|
| 397 |
yaxis_title=f"{'Techniques' if language == 'en' else 'Techniques'}",
|
| 398 |
plot_bgcolor='rgba(240, 240, 240, 1)',
|
|
@@ -410,7 +417,8 @@ def get_node_details(attack_path: Dict[str, Any], language: str = "en") -> str:
|
|
| 410 |
phase_labels = PHASE_LABELS_FR if language == "fr" else PHASE_LABELS_EN
|
| 411 |
label_key = "label_fr" if language == "fr" else "label_en"
|
| 412 |
|
| 413 |
-
|
|
|
|
| 414 |
|
| 415 |
for idx, node in enumerate(nodes, 1):
|
| 416 |
phase_label = phase_labels[node["phase"]]
|
|
|
|
| 344 |
|
| 345 |
phase_labels = PHASE_LABELS_FR if language == "fr" else PHASE_LABELS_EN
|
| 346 |
|
| 347 |
+
title_stats = "ATTACK STATISTICS" if language == "en" else "STATISTIQUES D'ATTAQUE"
|
| 348 |
+
lbl_stages = "Attack Stages" if language == "en" else "Étapes d'attaque"
|
| 349 |
+
lbl_connections = "Connection Steps" if language == "en" else "Étapes de connexion"
|
| 350 |
+
lbl_mitre = "MITRE Techniques Used" if language == "en" else "Techniques MITRE utilisées"
|
| 351 |
+
lbl_phases = "Attack Phases" if language == "en" else "Phases d'attaque"
|
| 352 |
+
lbl_involved = "Phases Involved" if language == "en" else "Phases impliquées"
|
| 353 |
+
|
| 354 |
stats = f"""
|
| 355 |
+
**{title_stats}**
|
| 356 |
|
| 357 |
+
- **{lbl_stages}:** {len(nodes)}
|
| 358 |
+
- **{lbl_connections}:** {len(edges)}
|
| 359 |
+
- **{lbl_mitre}:** {len(set(mitre_techniques))}
|
| 360 |
+
- **{lbl_phases}:** {len(unique_phases)}
|
| 361 |
|
| 362 |
+
**{lbl_involved}:**
|
| 363 |
"""
|
| 364 |
|
| 365 |
for phase in sorted(unique_phases):
|
|
|
|
| 399 |
])
|
| 400 |
|
| 401 |
fig.update_layout(
|
| 402 |
+
title="Attack Phase Breakdown" if language == "en" else "Répartition des phases d'attaque",
|
| 403 |
xaxis_title=f"{'MITRE Phase' if language == 'en' else 'Phase MITRE'}",
|
| 404 |
yaxis_title=f"{'Techniques' if language == 'en' else 'Techniques'}",
|
| 405 |
plot_bgcolor='rgba(240, 240, 240, 1)',
|
|
|
|
| 417 |
phase_labels = PHASE_LABELS_FR if language == "fr" else PHASE_LABELS_EN
|
| 418 |
label_key = "label_fr" if language == "fr" else "label_en"
|
| 419 |
|
| 420 |
+
breakdown_title = "ATTACK STAGES BREAKDOWN" if language == "en" else "DÉTAILS DES ÉTAPES D'ATTAQUE"
|
| 421 |
+
details = f"**{breakdown_title}**\n\n"
|
| 422 |
|
| 423 |
for idx, node in enumerate(nodes, 1):
|
| 424 |
phase_label = phase_labels[node["phase"]]
|
requirements.txt
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
gradio==4.44.0
|
| 2 |
plotly==5.18.0
|
| 3 |
pandas==2.1.4
|
| 4 |
-
huggingface_hub
|
|
|
|
| 1 |
gradio==4.44.0
|
| 2 |
plotly==5.18.0
|
| 3 |
pandas==2.1.4
|
| 4 |
+
huggingface_hub==0.24.7
|