Spaces:
Runtime error
Runtime error
Set colors for sleep time
Browse files- demo_list.py +9 -1
- style.css +28 -0
demo_list.py
CHANGED
|
@@ -135,6 +135,13 @@ class DemoList:
|
|
| 135 |
return '1'
|
| 136 |
return f'<div class="multiple-replicas">{replicas}</div>'
|
| 137 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 138 |
def prettify_df(self) -> pd.DataFrame:
|
| 139 |
new_rows = []
|
| 140 |
for _, row in self.df_raw.copy().iterrows():
|
|
@@ -167,7 +174,8 @@ class DemoList:
|
|
| 167 |
'sdk_version':
|
| 168 |
row.sdk_version,
|
| 169 |
'sleep_time':
|
| 170 |
-
self.
|
|
|
|
| 171 |
'replicas':
|
| 172 |
self.add_div_tag_to_replicas(row.replicas),
|
| 173 |
}
|
|
|
|
| 135 |
return '1'
|
| 136 |
return f'<div class="multiple-replicas">{replicas}</div>'
|
| 137 |
|
| 138 |
+
@staticmethod
|
| 139 |
+
def add_div_tag_to_sleep_time(sleep_time_s: str, hardware: str) -> str:
|
| 140 |
+
if hardware == 'cpu-basic':
|
| 141 |
+
return f'<div class="sleep-time-cpu-basic">{sleep_time_s}</div>'
|
| 142 |
+
s = sleep_time_s.replace(' ', '-')
|
| 143 |
+
return f'<div class="sleep-time-{s}">{sleep_time_s}</div>'
|
| 144 |
+
|
| 145 |
def prettify_df(self) -> pd.DataFrame:
|
| 146 |
new_rows = []
|
| 147 |
for _, row in self.df_raw.copy().iterrows():
|
|
|
|
| 174 |
'sdk_version':
|
| 175 |
row.sdk_version,
|
| 176 |
'sleep_time':
|
| 177 |
+
self.add_div_tag_to_sleep_time(
|
| 178 |
+
self.TO_TIME_STR[row.sleep_time], row.hardware),
|
| 179 |
'replicas':
|
| 180 |
self.add_div_tag_to_replicas(row.replicas),
|
| 181 |
}
|
style.css
CHANGED
|
@@ -66,6 +66,34 @@ div.hardware-cpu-basic {
|
|
| 66 |
color: deepskyblue;
|
| 67 |
}
|
| 68 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
/* set colors for replica */
|
| 70 |
div.multiple-replicas {
|
| 71 |
color: red;
|
|
|
|
| 66 |
color: deepskyblue;
|
| 67 |
}
|
| 68 |
|
| 69 |
+
/* set colors for sleep time */
|
| 70 |
+
div.sleep-time-cpu-basic {
|
| 71 |
+
color: gray;
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
div.sleep-time-5-minutes,
|
| 75 |
+
div.sleep-time-10-minutes,
|
| 76 |
+
div.sleep-time-15-minutes,
|
| 77 |
+
div.sleep-time-30-minutes {
|
| 78 |
+
color: green;
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
div.sleep-time-1-hour,
|
| 82 |
+
div.sleep-time-10-hours {
|
| 83 |
+
color: orange;
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
div.sleep-time-24-hours,
|
| 87 |
+
div.sleep-time-48-hours,
|
| 88 |
+
div.sleep-time-72-hours,
|
| 89 |
+
div.sleep-time-1-week {
|
| 90 |
+
color: orangered;
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
div.sleep-time-null {
|
| 94 |
+
color: red;
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
/* set colors for replica */
|
| 98 |
div.multiple-replicas {
|
| 99 |
color: red;
|