Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,8 +10,13 @@ import time
|
|
| 10 |
import datetime
|
| 11 |
import requests, json
|
| 12 |
|
| 13 |
-
from
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
loop = asyncio.get_event_loop()
|
| 17 |
# Monkey patch
|
|
@@ -100,6 +105,20 @@ def get_id_from_p2p(i):
|
|
| 100 |
else:
|
| 101 |
return "no id"
|
| 102 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
with gr.Blocks() as demo:
|
| 104 |
count = 0
|
| 105 |
aa = gr.Interface(
|
|
|
|
| 10 |
import datetime
|
| 11 |
import requests, json
|
| 12 |
|
| 13 |
+
from pprint import pprint
|
| 14 |
+
import hivemind
|
| 15 |
+
from petals.constants import PUBLIC_INITIAL_PEERS
|
| 16 |
+
from health import fetch_health_state
|
| 17 |
+
|
| 18 |
+
dht = hivemind.DHT(initial_peers=PUBLIC_INITIAL_PEERS, client_mode=True, start=True)
|
| 19 |
+
model_name = "quantumaikr/llama-2-70b-fb16-korean"
|
| 20 |
|
| 21 |
loop = asyncio.get_event_loop()
|
| 22 |
# Monkey patch
|
|
|
|
| 105 |
else:
|
| 106 |
return "no id"
|
| 107 |
|
| 108 |
+
# Blockchain code
|
| 109 |
+
|
| 110 |
+
def get_peers():
|
| 111 |
+
data = fetch_health_state(dht)
|
| 112 |
+
out = []
|
| 113 |
+
for d in data['model_reports']:
|
| 114 |
+
if d['name'] == model_name:
|
| 115 |
+
for r in d['server_rows']:
|
| 116 |
+
out.append(r['peer_id'])
|
| 117 |
+
|
| 118 |
+
return out
|
| 119 |
+
|
| 120 |
+
|
| 121 |
+
|
| 122 |
with gr.Blocks() as demo:
|
| 123 |
count = 0
|
| 124 |
aa = gr.Interface(
|