You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I pulled this code down and have been very confused with the documentation on how to run it on a local data set. I'm looking at this piece of code below.
I have a CSV which has all the asset names along with the occurrences. What do I need to do to feed this data to calculate the rarities? Is it possible to just feed a dictionary with all the assets at once?
If you can show me an example of what I need to do that would be great!
Thank you!
from open_rarity import Collection, OpenRarityScorer, Token
from open_rarity.rarity_ranker import RarityRanker
if __name__ == "__main__":
scorer = OpenRarityScorer()
collection = Collection(
name="My Collection Name",
tokens=[
Token.from_erc721(
contract_address="0xa3049...",
token_id=1,
metadata_dict={"hat": "cap", "shirt": "blue"},
),
Token.from_erc721(
contract_address="0xa3049...",
token_id=2,
metadata_dict={"hat": "visor", "shirt": "green"},
),
Token.from_erc721(
contract_address="0xa3049...",
token_id=3,
metadata_dict={"hat": "visor", "shirt": "blue"},
),
],
) # Replace inputs with your collection-specific details here
# Generate scores for a collection
token_scores = scorer.score_collection(collection=collection)
print(f"Token scores for collection: {token_scores}")
# Generate score for a single token in a collection
token = collection.tokens[0] # Your token details filled in
token_score = scorer.score_token(collection=collection, token=token)
# Better yet.. just use ranker directly!
ranked_tokens = RarityRanker.rank_collection(collection=collection)
for ranked_token in ranked_tokens:
print(
f"Token {ranked_token.token} has rank {ranked_token.rank} "
"and score {ranked_token.score}"
)
The text was updated successfully, but these errors were encountered:
Hi! You can definitely read CSV and create list of Tokens with required fields and then use the scorrer interface to produce collection ranks. Can you share CSV file, i could drop python snippet to help you.
I pulled this code down and have been very confused with the documentation on how to run it on a local data set. I'm looking at this piece of code below.
I have a CSV which has all the asset names along with the occurrences. What do I need to do to feed this data to calculate the rarities? Is it possible to just feed a dictionary with all the assets at once?
If you can show me an example of what I need to do that would be great!
Thank you!
The text was updated successfully, but these errors were encountered: