Spaces:
Running
Running
Commit
·
83891df
1
Parent(s):
3918634
add alpha to tao price, add is active checkbox, make row indexes show automagically
Browse files
app.py
CHANGED
|
@@ -4,7 +4,7 @@ import gradio as gr
|
|
| 4 |
import pandas as pd
|
| 5 |
import time
|
| 6 |
|
| 7 |
-
#
|
| 8 |
g_cached_data: pd.DataFrame | None = None
|
| 9 |
g_last_fetch_time = 0.0
|
| 10 |
|
|
@@ -24,13 +24,14 @@ def fetch_incentive_data() -> pd.DataFrame:
|
|
| 24 |
for sn in range(1, 129):
|
| 25 |
subnet = subnets[sn]
|
| 26 |
metagraph = metagraphs[sn]
|
| 27 |
-
|
|
|
|
| 28 |
# The incentives that are assigned to the owner hotkey are being burned/not given out
|
| 29 |
# by Maciej Kula [Bo𝞃, Bo𝞃] 23.07.2025
|
| 30 |
-
addresses = [("hotkey", subnet.owner_hotkey)] # So don't include coldkey.
|
| 31 |
|
| 32 |
for key_type, address in addresses:
|
| 33 |
-
uid =
|
| 34 |
if uid is None:
|
| 35 |
continue
|
| 36 |
|
|
@@ -38,16 +39,17 @@ def fetch_incentive_data() -> pd.DataFrame:
|
|
| 38 |
if incentive <= 0:
|
| 39 |
continue
|
| 40 |
|
|
|
|
| 41 |
data.append([
|
| 42 |
f"[netuid: {sn} / {subnet.subnet_name}](https://taostats.io/subnets/{sn})",
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
|
|
|
| 46 |
])
|
| 47 |
break
|
| 48 |
|
| 49 |
-
|
| 50 |
-
df = pd.DataFrame(data, columns=["#", "Subnet", "Burn (%)", "UID", "Address"]) # type: ignore
|
| 51 |
print(f"{len(data)} subnets burn")
|
| 52 |
return df
|
| 53 |
|
|
@@ -74,8 +76,9 @@ with gr.Blocks(title="Bittensor Subnet Incentives") as demo:
|
|
| 74 |
)
|
| 75 |
next_process_text = gr.Textbox(label="Next refresh time", interactive=False)
|
| 76 |
output_df = gr.DataFrame(
|
| 77 |
-
datatype=["
|
| 78 |
label="Subnet Burn Data",
|
|
|
|
| 79 |
interactive=False,
|
| 80 |
max_height=1000000
|
| 81 |
)
|
|
|
|
| 4 |
import pandas as pd
|
| 5 |
import time
|
| 6 |
|
| 7 |
+
# primitive caching
|
| 8 |
g_cached_data: pd.DataFrame | None = None
|
| 9 |
g_last_fetch_time = 0.0
|
| 10 |
|
|
|
|
| 24 |
for sn in range(1, 129):
|
| 25 |
subnet = subnets[sn]
|
| 26 |
metagraph = metagraphs[sn]
|
| 27 |
+
hotkeys_to_uid = {hk: i for i, hk in enumerate(metagraph.hotkeys)}
|
| 28 |
+
|
| 29 |
# The incentives that are assigned to the owner hotkey are being burned/not given out
|
| 30 |
# by Maciej Kula [Bo𝞃, Bo𝞃] 23.07.2025
|
| 31 |
+
addresses = [("hotkey", subnet.owner_hotkey)] # So don't include ("coldkey", subnet.owner_coldkey).
|
| 32 |
|
| 33 |
for key_type, address in addresses:
|
| 34 |
+
uid = hotkeys_to_uid.get(address, None)
|
| 35 |
if uid is None:
|
| 36 |
continue
|
| 37 |
|
|
|
|
| 39 |
if incentive <= 0:
|
| 40 |
continue
|
| 41 |
|
| 42 |
+
is_active = metagraph.pending_root_emission.tao > 0
|
| 43 |
data.append([
|
| 44 |
f"[netuid: {sn} / {subnet.subnet_name}](https://taostats.io/subnets/{sn})",
|
| 45 |
+
is_active,
|
| 46 |
+
round(subnet.alpha_to_tao(1).tao, 6),
|
| 47 |
+
round(incentive*100, 2),
|
| 48 |
+
f"[{address}](https://taostats.io/{key_type}/{address}) [{uid}]"
|
| 49 |
])
|
| 50 |
break
|
| 51 |
|
| 52 |
+
df = pd.DataFrame(data, columns=["Subnet", "Active", "α to τ", "Burn (%)", "Address [UID]"]) # type: ignore
|
|
|
|
| 53 |
print(f"{len(data)} subnets burn")
|
| 54 |
return df
|
| 55 |
|
|
|
|
| 76 |
)
|
| 77 |
next_process_text = gr.Textbox(label="Next refresh time", interactive=False)
|
| 78 |
output_df = gr.DataFrame(
|
| 79 |
+
datatype=["markdown", "bool", "number", "number", "markdown"],
|
| 80 |
label="Subnet Burn Data",
|
| 81 |
+
show_row_numbers=True,
|
| 82 |
interactive=False,
|
| 83 |
max_height=1000000
|
| 84 |
)
|