Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -83,8 +83,12 @@ total_gpu = sample_data['total']['total']
|
|
| 83 |
used_gpu = sample_data['total']['used']
|
| 84 |
timestamp_list = []
|
| 85 |
|
|
|
|
| 86 |
name_list = []
|
| 87 |
timestamp_gpu_data = []
|
|
|
|
|
|
|
|
|
|
| 88 |
for block in sample_data['chain']:
|
| 89 |
timestamp_list.append(block['timestamp'] )
|
| 90 |
for t in block['transactions']:
|
|
@@ -93,13 +97,20 @@ for block in sample_data['chain']:
|
|
| 93 |
name_list.append(t['id'])
|
| 94 |
|
| 95 |
timestamp_gpu_data = [[0 for _ in range(len(name_list))]]
|
|
|
|
| 96 |
for block in sample_data['chain']:
|
| 97 |
temp = timestamp_gpu_data[int(block['index']) - 1]
|
|
|
|
|
|
|
|
|
|
|
|
|
| 98 |
for t in block['transactions']:
|
| 99 |
if t['kind'] == "add":
|
| 100 |
temp[name_list.index(t['id'])] += int(t['data'])
|
| 101 |
elif t['kind'] == "out":
|
| 102 |
temp[name_list.index(t['id'])] = 0
|
|
|
|
|
|
|
| 103 |
timestamp_gpu_data.append(copy.deepcopy(temp))
|
| 104 |
timestamp_gpu_data = timestamp_gpu_data[0:-1]
|
| 105 |
col1, col2, col3 = st.columns(3)
|
|
@@ -113,7 +124,10 @@ last_timestamp = strftime('%Y-%m-%d %I:%M:%S %p', localtime( sample_data['chain'
|
|
| 113 |
st.area_chart(chart_data)
|
| 114 |
st.caption(f'last updated in timestamp {last_timestamp}.')
|
| 115 |
|
| 116 |
-
|
|
|
|
|
|
|
|
|
|
| 117 |
|
| 118 |
class BubbleChart:
|
| 119 |
def __init__(self, data, bubble_spacing=0, n_bins=5):
|
|
|
|
| 83 |
used_gpu = sample_data['total']['used']
|
| 84 |
timestamp_list = []
|
| 85 |
|
| 86 |
+
|
| 87 |
name_list = []
|
| 88 |
timestamp_gpu_data = []
|
| 89 |
+
timestamp_inference_data = []
|
| 90 |
+
timestamp_list_date = []
|
| 91 |
+
|
| 92 |
for block in sample_data['chain']:
|
| 93 |
timestamp_list.append(block['timestamp'] )
|
| 94 |
for t in block['transactions']:
|
|
|
|
| 97 |
name_list.append(t['id'])
|
| 98 |
|
| 99 |
timestamp_gpu_data = [[0 for _ in range(len(name_list))]]
|
| 100 |
+
timestamp_inference_data = [sample_data['chain'][0]['timestamp']]
|
| 101 |
for block in sample_data['chain']:
|
| 102 |
temp = timestamp_gpu_data[int(block['index']) - 1]
|
| 103 |
+
if strftime('%Y-%m-%d', localtime( timestamp_list_date[-1] )) != strftime('%Y-%m-%d', localtime( block['timestamp'] )):
|
| 104 |
+
timestamp_list_date.append(block['timestamp'])
|
| 105 |
+
timestamp_inference_data.append(0)
|
| 106 |
+
|
| 107 |
for t in block['transactions']:
|
| 108 |
if t['kind'] == "add":
|
| 109 |
temp[name_list.index(t['id'])] += int(t['data'])
|
| 110 |
elif t['kind'] == "out":
|
| 111 |
temp[name_list.index(t['id'])] = 0
|
| 112 |
+
elif:
|
| 113 |
+
timestamp_inference_data[-1] += 1
|
| 114 |
timestamp_gpu_data.append(copy.deepcopy(temp))
|
| 115 |
timestamp_gpu_data = timestamp_gpu_data[0:-1]
|
| 116 |
col1, col2, col3 = st.columns(3)
|
|
|
|
| 124 |
st.area_chart(chart_data)
|
| 125 |
st.caption(f'last updated in timestamp {last_timestamp}.')
|
| 126 |
|
| 127 |
+
for d in timestamp_list_date:
|
| 128 |
+
d = strftime('%Y-%m-%d', localtime( d ))
|
| 129 |
+
call_data = pd.DataFrame(timestamp_inference_data, columns = ["inference call"], index = timestamp_list_date)
|
| 130 |
+
st.area_chart(call_data)
|
| 131 |
|
| 132 |
class BubbleChart:
|
| 133 |
def __init__(self, data, bubble_spacing=0, n_bins=5):
|