richardblythman commited on
Commit
19e145e
1 Parent(s): 7ea74fb

add app.py, config and requirements

Browse files
Files changed (4) hide show
  1. README.md +1 -1
  2. app.py +36 -0
  3. config.ini +10 -0
  4. requirements.txt +2 -0
README.md CHANGED
@@ -1,5 +1,5 @@
1
  ---
2
- title: Crypto Token Calculator
3
  emoji: 🐢
4
  colorFrom: pink
5
  colorTo: yellow
 
1
  ---
2
+ title: Ocean Token Calculator
3
  emoji: 🐢
4
  colorFrom: pink
5
  colorTo: yellow
app.py ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from ocean_lib.config import Config
3
+ from ocean_lib.ocean.ocean import Ocean
4
+ from ocean_lib.web3_internal.wallet import Wallet
5
+ import os
6
+
7
+ config = Config('config.ini')
8
+ ocean = Ocean(config)
9
+
10
+ def greet(private_key):
11
+ wallet = Wallet(ocean.web3, private_key, transaction_timeout=20, block_confirmations=config.block_confirmations)
12
+ return wallet.address
13
+
14
+ description = (
15
+ "This demo calculate the number of tokens in your wallet using the Ocean Python library. "
16
+ )
17
+
18
+ article = (
19
+ "<p style='text-align: center'>"
20
+ "<a href='https://oceanprotocol.com/' target='_blank'>Ocean Protocol</a> | "
21
+ "<a href='https://github.com/oceanprotocol/ocean.py' target='_blank'>Ocean Python Library</a> | "
22
+ "<a href='https://www.algovera.ai' target='_blank'>Algovera</a>"
23
+ "</p>"
24
+ )
25
+
26
+ interface = gr.Interface(
27
+ fn=greet,
28
+ inputs="text",
29
+ outputs="text",
30
+ title="Ocean Token Calculator",
31
+ description=description,
32
+ article=article,
33
+ theme="huggingface",
34
+ )
35
+
36
+ interface.launch()
config.ini ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ [eth-network]
2
+ network = https://rinkeby.infura.io/v3/d163c48816434b0bbb3ac3925d6c6c80
3
+ block_confirmations = 0
4
+
5
+ [resources]
6
+ metadata_cache_uri = https://aquarius.oceanprotocol.com
7
+ provider.url = https://provider.rinkeby.oceanprotocol.com
8
+ provider.address = 0x00bd138abd70e2f00903268f3db08f2d25677c9e
9
+
10
+ downloads.path = consume-downloads
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ wheel
2
+ ocean-lib