This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from dotenv import load_dotenv; load_dotenv() | |
from gpt_index import GPTTreeIndex, SimpleDirectoryReader | |
from gpt_index.schema import Document | |
from PIL import Image | |
from pathlib import Path | |
import os | |
import pytesseract | |
import pdf2image | |
import time |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Usage: python top_miner.py --wallet.name <name> --wallet.hotkey <hotkey> | |
import bittensor | |
subtensor = bittensor.subtensor(log_verbose=False) | |
root_validators = subtensor.neurons_lite(netuid=0) | |
netuid = 24 | |
metagraph = subtensor.metagraph(netuid) | |
miner_ranks = [(uid, metagraph.ranks[uid]) for uid in metagraph.uids] | |
# sort miners by ascending rank, take the top one (i.e. last one) and print its uid | |
print(f"The top miner on SN{netuid} is {sorted(miner_ranks, key=lambda x: x[1])[-1][0]}") |