ldhldh commited on
Commit
7cc0b92
1 Parent(s): f33f723

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -5,7 +5,7 @@ from gradio import routes
5
  from typing import List, Type
6
 
7
  import requests, os, re, asyncio, json
8
- import math
9
  import time
10
  import datetime
11
  import hashlib
@@ -140,10 +140,15 @@ def get_gpus():
140
  for id, mem in blockchain.user_gpus.items():
141
  output.append({"name":get_name(id),"gpu":mem})
142
  return output
 
 
 
 
 
143
 
144
  def get_data():
145
  output = []
146
- output.append({"gpus":get_gpus(), "total":{"total" : blockchain.get_total_gpu_mem(), "used":38}, "chain":blockchain.chain})
147
 
148
  return output
149
 
 
5
  from typing import List, Type
6
 
7
  import requests, os, re, asyncio, json
8
+ import math, random
9
  import time
10
  import datetime
11
  import hashlib
 
140
  for id, mem in blockchain.user_gpus.items():
141
  output.append({"name":get_name(id),"gpu":mem})
142
  return output
143
+ def used_gpu():
144
+ output = 0
145
+ for mem in get_gpus():
146
+ output += mem * (5 + random.randrange(1,4)/10)
147
+ return output
148
 
149
  def get_data():
150
  output = []
151
+ output.append({"gpus":get_gpus(), "total":{"total" : blockchain.get_total_gpu_mem(), "used":used_gpu()}, "chain":blockchain.chain})
152
 
153
  return output
154