Spaces:
Sleeping
Sleeping
darisdzakwanhoesien2
commited on
Commit
·
98bc6d9
1
Parent(s):
d812b98
Add XAI
Browse files
app.py
CHANGED
|
@@ -251,8 +251,7 @@ def visualize_knowledge_graph(g):
|
|
| 251 |
# Handle empty graph case
|
| 252 |
if not nx_graph.nodes():
|
| 253 |
plt.figure(figsize=(12, 8))
|
| 254 |
-
plt.text(0.5, 0.5, "No knowledge graph to display.\\n(No aspects were detected in the documents)",
|
| 255 |
-
ha='center', va='center', fontsize=14, color='gray')
|
| 256 |
buf = io.BytesIO()
|
| 257 |
plt.savefig(buf, format='png', bbox_inches='tight')
|
| 258 |
buf.seek(0)
|
|
@@ -292,7 +291,7 @@ ha='center', va='center', fontsize=14, color='gray')
|
|
| 292 |
plt.title("Knowledge Graph of ESG Aspects", size=18)
|
| 293 |
buf = io.BytesIO()
|
| 294 |
plt.savefig(buf, format='png', bbox_inches='tight')
|
| 295 |
-
buf.seek(0)
|
| 296 |
img = Image.open(buf)
|
| 297 |
plt.close()
|
| 298 |
return img
|
|
|
|
| 251 |
# Handle empty graph case
|
| 252 |
if not nx_graph.nodes():
|
| 253 |
plt.figure(figsize=(12, 8))
|
| 254 |
+
plt.text(0.5, 0.5, "No knowledge graph to display.\\n(No aspects were detected in the documents)", ha='center', va='center', fontsize=14, color='gray')
|
|
|
|
| 255 |
buf = io.BytesIO()
|
| 256 |
plt.savefig(buf, format='png', bbox_inches='tight')
|
| 257 |
buf.seek(0)
|
|
|
|
| 291 |
plt.title("Knowledge Graph of ESG Aspects", size=18)
|
| 292 |
buf = io.BytesIO()
|
| 293 |
plt.savefig(buf, format='png', bbox_inches='tight')
|
| 294 |
+
buf.seek(0)
|
| 295 |
img = Image.open(buf)
|
| 296 |
plt.close()
|
| 297 |
return img
|