import gradio as gr from ocean_lib.config import Config from ocean_lib.ocean.ocean import Ocean from ocean_lib.web3_internal.wallet import Wallet import os config = Config('config.ini') ocean = Ocean(config) def greet(private_key): wallet = Wallet(ocean.web3, private_key, transaction_timeout=20, block_confirmations=config.block_confirmations) return wallet.address description = ( "This demo calculate the number of tokens in your wallet on the Rinkeby test network using the Ocean Python library. " "You can export your private key from your metamask wallet. We highly recommend doing this with a wallet that has no real tokens in it (only Rinkeby tokens)." "For more info on private keys, see [this](https://github.com/oceanprotocol/ocean.py/blob/main/READMEs/wallets.md) from the ocean.py documentation" ) article = ( "
" "Ocean Protocol | " "Ocean Python Library | " "Algovera" "
" ) interface = gr.Interface( greet, "text", [ gr.outputs.Textbox(label="Public Key") ], title="Ocean Token Calculator", description=description, article=article, theme="huggingface", ) interface.launch()