Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -91,13 +91,13 @@ for block in sample_data['chain']:
|
|
| 91 |
|
| 92 |
timestamp_gpu_data = [[0 for _ in range(len(name_list))]]
|
| 93 |
for block in sample_data['chain']:
|
| 94 |
-
temp = timestamp_gpu_data[block['index']]
|
| 95 |
for t in block['transactions']:
|
| 96 |
if t['kind'] == "add":
|
| 97 |
temp[name_list.find(t['id'])] += int(t['data'])
|
| 98 |
elif t['kind'] == "out":
|
| 99 |
temp[name_list.find(t['id'])] = 0
|
| 100 |
-
|
| 101 |
|
| 102 |
col1, col2, col3 = st.columns(3)
|
| 103 |
col1.metric("Total GPU", f"{total_gpu} GB", f"{user_num} users are sharing now")
|
|
@@ -107,7 +107,7 @@ col3.metric("Percent", f"{100 * used_gpu/total_gpu} %",)
|
|
| 107 |
chart_data = pd.DataFrame(timestamp_gpu_data)
|
| 108 |
|
| 109 |
last_timestamp = sample_data['chain'][-1]['timestamp']
|
| 110 |
-
st.area_chart(chart_data, caption=f'last updated in timestamp {last_timestamp}.')
|
| 111 |
|
| 112 |
|
| 113 |
|
|
|
|
| 91 |
|
| 92 |
timestamp_gpu_data = [[0 for _ in range(len(name_list))]]
|
| 93 |
for block in sample_data['chain']:
|
| 94 |
+
temp = timestamp_gpu_data[int(block['index']) - 1]
|
| 95 |
for t in block['transactions']:
|
| 96 |
if t['kind'] == "add":
|
| 97 |
temp[name_list.find(t['id'])] += int(t['data'])
|
| 98 |
elif t['kind'] == "out":
|
| 99 |
temp[name_list.find(t['id'])] = 0
|
| 100 |
+
timestamp_gpu_data.append(temp)
|
| 101 |
|
| 102 |
col1, col2, col3 = st.columns(3)
|
| 103 |
col1.metric("Total GPU", f"{total_gpu} GB", f"{user_num} users are sharing now")
|
|
|
|
| 107 |
chart_data = pd.DataFrame(timestamp_gpu_data)
|
| 108 |
|
| 109 |
last_timestamp = sample_data['chain'][-1]['timestamp']
|
| 110 |
+
st.area_chart(chart_data, columns = name_list,caption=f'last updated in timestamp {last_timestamp}.')
|
| 111 |
|
| 112 |
|
| 113 |
|