from kyne.integrations import HuggingFaceMarketfrom kyne.wallet import SUIWallet# Initialize with your walletmarket = HuggingFaceMarket( wallet=SUIWallet.from_private_key("0x..."), hf_token="your_hf_token")# List a model on the marketplacelisting = await market.list_model( model_id="bert-base-uncased", price=1000, # Price in SUI tokens config={ "revenue_share": 0.1, # Share for data contributors "storage_epochs": 12 # Storage duration })# Track model usage and earningsstats = await market.get_model_stats(listing.id)print(f"Total earnings: {stats.earnings} SUI")print(f"Total uses: {stats.usage_count}")
# Import model from HuggingFacemodel = await market.import_model( "bert-base-uncased", verify_integrity=True)
Configure Storage
Copy
# Set storage parametersstorage = await model.configure_storage( min_nodes=7, # 2f+1 for fault tolerance epochs=12, # Storage duration redundancy=2 # Red Stuff encoding level)
Create Listing
Copy
# List on marketplacelisting = await model.create_listing( price=1000, # Base price in SUI usage_fee=10, # Per-use fee revenue_share=0.1 # Share for contributors)