Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -80,10 +80,12 @@ sample_data = {
|
|
| 80 |
user_num = len(sample_data['gpus'].items())
|
| 81 |
total_gpu = sample_data['total']['total']
|
| 82 |
used_gpu = sample_data['total']['used']
|
|
|
|
| 83 |
|
| 84 |
name_list = []
|
| 85 |
timestamp_gpu_data = []
|
| 86 |
for block in sample_data['chain']:
|
|
|
|
| 87 |
for t in block['transactions']:
|
| 88 |
if t['kind'] == "add":
|
| 89 |
if not t['id'] in name_list:
|
|
@@ -104,7 +106,7 @@ col1.metric("Total GPU", f"{total_gpu} GB", f"{user_num} users are sharing now")
|
|
| 104 |
col2.metric("Used", f"{used_gpu} GB")
|
| 105 |
col3.metric("Percent", f"{round(100 * used_gpu/total_gpu, 2)} %",)
|
| 106 |
|
| 107 |
-
chart_data = pd.DataFrame(timestamp_gpu_data, columns = name_list)
|
| 108 |
|
| 109 |
last_timestamp = sample_data['chain'][-1]['timestamp']
|
| 110 |
st.area_chart(chart_data)
|
|
|
|
| 80 |
user_num = len(sample_data['gpus'].items())
|
| 81 |
total_gpu = sample_data['total']['total']
|
| 82 |
used_gpu = sample_data['total']['used']
|
| 83 |
+
timestamp_list = []
|
| 84 |
|
| 85 |
name_list = []
|
| 86 |
timestamp_gpu_data = []
|
| 87 |
for block in sample_data['chain']:
|
| 88 |
+
timestamp_list.append(block['timestamp'])
|
| 89 |
for t in block['transactions']:
|
| 90 |
if t['kind'] == "add":
|
| 91 |
if not t['id'] in name_list:
|
|
|
|
| 106 |
col2.metric("Used", f"{used_gpu} GB")
|
| 107 |
col3.metric("Percent", f"{round(100 * used_gpu/total_gpu, 2)} %",)
|
| 108 |
|
| 109 |
+
chart_data = pd.DataFrame(timestamp_gpu_data, columns = name_list, rows = timestamp_list)
|
| 110 |
|
| 111 |
last_timestamp = sample_data['chain'][-1]['timestamp']
|
| 112 |
st.area_chart(chart_data)
|