Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -110,6 +110,15 @@ def get_peers(model_name):
|
|
110 |
out.append(r['peer_id'])
|
111 |
return out
|
112 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
blockchain = Blockchain()
|
114 |
|
115 |
def add_transaction(id, kind, data):
|
@@ -148,7 +157,7 @@ def used_gpu():
|
|
148 |
|
149 |
def get_data():
|
150 |
output = []
|
151 |
-
output.append({"gpus":get_gpus(), "total":{"total" : blockchain.get_total_gpu_mem(), "used":
|
152 |
|
153 |
return output
|
154 |
|
|
|
110 |
out.append(r['peer_id'])
|
111 |
return out
|
112 |
|
113 |
+
|
114 |
+
def get_used_gpus(model_name):
|
115 |
+
data = requests.get("https://health.petals.dev/api/v1/state").json()
|
116 |
+
out = []
|
117 |
+
for d in data['model_reports']:
|
118 |
+
if d['name'] == model_name:
|
119 |
+
return round(d['num_blocks']/0.45, 2)
|
120 |
+
return 0
|
121 |
+
|
122 |
blockchain = Blockchain()
|
123 |
|
124 |
def add_transaction(id, kind, data):
|
|
|
157 |
|
158 |
def get_data():
|
159 |
output = []
|
160 |
+
output.append({"gpus":get_gpus(), "total":{"total" : blockchain.get_total_gpu_mem(), "used":get_used_gpus(model_name)}, "chain":blockchain.chain})
|
161 |
|
162 |
return output
|
163 |
|