Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -72,28 +72,50 @@ def format_classification_report(labels, preds):
|
|
72 |
# Convert the report string to a dictionary
|
73 |
report_dict = classification_report(labels, preds, output_dict=True)
|
74 |
|
75 |
-
# Create an HTML table
|
76 |
html = """
|
77 |
<style>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
.report-table {
|
79 |
border-collapse: collapse;
|
80 |
width: 100%;
|
81 |
font-family: Arial, sans-serif;
|
|
|
|
|
82 |
}
|
83 |
.report-table th, .report-table td {
|
84 |
-
border: 1px solid
|
85 |
padding: 8px;
|
86 |
text-align: center;
|
87 |
}
|
88 |
.report-table th {
|
89 |
-
background-color:
|
90 |
font-weight: bold;
|
91 |
}
|
92 |
.report-table tr:nth-child(even) {
|
93 |
-
background-color:
|
94 |
}
|
95 |
.report-table tr:hover {
|
96 |
-
background-color:
|
97 |
}
|
98 |
</style>
|
99 |
<table class="report-table">
|
@@ -143,7 +165,7 @@ def format_classification_report(labels, preds):
|
|
143 |
"""
|
144 |
|
145 |
return html
|
146 |
-
|
147 |
def evaluate_model(labels, preds):
|
148 |
cm = confusion_matrix(labels, preds)
|
149 |
accuracy = accuracy_score(labels, preds)
|
|
|
72 |
# Convert the report string to a dictionary
|
73 |
report_dict = classification_report(labels, preds, output_dict=True)
|
74 |
|
75 |
+
# Create an HTML table with updated CSS
|
76 |
html = """
|
77 |
<style>
|
78 |
+
@media (prefers-color-scheme: dark) {
|
79 |
+
:root {
|
80 |
+
--bg-color: #2d2d2d;
|
81 |
+
--text-color: #e0e0e0;
|
82 |
+
--border-color: #555;
|
83 |
+
--header-bg: #3d3d3d;
|
84 |
+
--row-hover: #3a3a3a;
|
85 |
+
--row-even: #333;
|
86 |
+
}
|
87 |
+
}
|
88 |
+
@media (prefers-color-scheme: light) {
|
89 |
+
:root {
|
90 |
+
--bg-color: #ffffff;
|
91 |
+
--text-color: #333333;
|
92 |
+
--border-color: #ddd;
|
93 |
+
--header-bg: #f2f2f2;
|
94 |
+
--row-hover: #f5f5f5;
|
95 |
+
--row-even: #f9f9f9;
|
96 |
+
}
|
97 |
+
}
|
98 |
.report-table {
|
99 |
border-collapse: collapse;
|
100 |
width: 100%;
|
101 |
font-family: Arial, sans-serif;
|
102 |
+
background-color: var(--bg-color);
|
103 |
+
color: var(--text-color);
|
104 |
}
|
105 |
.report-table th, .report-table td {
|
106 |
+
border: 1px solid var(--border-color);
|
107 |
padding: 8px;
|
108 |
text-align: center;
|
109 |
}
|
110 |
.report-table th {
|
111 |
+
background-color: var(--header-bg);
|
112 |
font-weight: bold;
|
113 |
}
|
114 |
.report-table tr:nth-child(even) {
|
115 |
+
background-color: var(--row-even);
|
116 |
}
|
117 |
.report-table tr:hover {
|
118 |
+
background-color: var(--row-hover);
|
119 |
}
|
120 |
</style>
|
121 |
<table class="report-table">
|
|
|
165 |
"""
|
166 |
|
167 |
return html
|
168 |
+
|
169 |
def evaluate_model(labels, preds):
|
170 |
cm = confusion_matrix(labels, preds)
|
171 |
accuracy = accuracy_score(labels, preds)
|