Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -107,18 +107,16 @@ def get_id_from_p2p(i):
|
|
| 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'] ==
|
| 115 |
for r in d['server_rows']:
|
| 116 |
out.append(r['peer_id'])
|
| 117 |
|
| 118 |
return out
|
| 119 |
|
| 120 |
-
get_peers()
|
| 121 |
-
|
| 122 |
with gr.Blocks() as demo:
|
| 123 |
count = 0
|
| 124 |
aa = gr.Interface(
|
|
@@ -183,5 +181,12 @@ with gr.Blocks() as demo:
|
|
| 183 |
outputs="text",
|
| 184 |
description="get_p, p2p id๋ก ์ผ๋ฐ id ๋ฐํ. ์์ผ๋ฉด no id. \n /run/predict_8",
|
| 185 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 186 |
|
| 187 |
demo.queue(max_size=32).launch(enable_queue=True)
|
|
|
|
| 107 |
|
| 108 |
# Blockchain code
|
| 109 |
|
| 110 |
+
def get_peers(name):
|
| 111 |
data = fetch_health_state(dht)
|
| 112 |
out = []
|
| 113 |
for d in data['model_reports']:
|
| 114 |
+
if d['name'] == name:
|
| 115 |
for r in d['server_rows']:
|
| 116 |
out.append(r['peer_id'])
|
| 117 |
|
| 118 |
return out
|
| 119 |
|
|
|
|
|
|
|
| 120 |
with gr.Blocks() as demo:
|
| 121 |
count = 0
|
| 122 |
aa = gr.Interface(
|
|
|
|
| 181 |
outputs="text",
|
| 182 |
description="get_p, p2p id๋ก ์ผ๋ฐ id ๋ฐํ. ์์ผ๋ฉด no id. \n /run/predict_8",
|
| 183 |
)
|
| 184 |
+
|
| 185 |
+
gpeer = gr.Interface(
|
| 186 |
+
fn=get_peers,
|
| 187 |
+
inputs=["text"],
|
| 188 |
+
outputs="text",
|
| 189 |
+
description="get_peers, ํด๋น ๋ชจ๋ธ์ ๋ถ์ฐ์ฒ๋ฆฌ์ค์ธ peer๋ค์ p2p id list ๋ฐํ\n /run/predict_8",
|
| 190 |
+
)
|
| 191 |
|
| 192 |
demo.queue(max_size=32).launch(enable_queue=True)
|