mirror of
https://github.com/oceanprotocol/docs.git
synced 2024-11-26 19:49:26 +01:00
Update the example asset in React App Tutorial
This commit is contained in:
parent
4c29cd4d8b
commit
4627294ac2
@ -18,36 +18,67 @@ To do that, we need to add the following code after `window.ethereum.enable()` l
|
||||
```js
|
||||
const asset = {
|
||||
base: {
|
||||
name: 'Office Humidity',
|
||||
description: 'Weather information of UK including temperature and humidity',
|
||||
dateCreated: '2012-02-01T10:55:11+00:00',
|
||||
author: 'Met Office',
|
||||
size: '3.1bg',
|
||||
license: 'Public Domain',
|
||||
copyrightHolder: 'Met Office',
|
||||
contentUrls: [
|
||||
'https://testocnfiles.blob.core.windows.net/testfiles/testzkp.zip'
|
||||
],
|
||||
contentType: 'text/csv',
|
||||
links: [
|
||||
name: "10 Monkey Species Small",
|
||||
dateCreated: "2012-02-01T10:55:11Z",
|
||||
author: "Mario",
|
||||
license: "CC0: Public Domain",
|
||||
contentType: "jpg/txt",
|
||||
price: 10,
|
||||
files: [
|
||||
{
|
||||
name: 'Dataset sample',
|
||||
type: 'sample',
|
||||
url:
|
||||
'http://data.ceda.ac.uk/badc/ukcp09/data/gridded-land-obs/gridded-land-obs-daily/'
|
||||
checksum: "2bf9d229d110d1976cdf85e9f3256c7f",
|
||||
checksumType: "MD5",
|
||||
contentLength: 12057507,
|
||||
url: "https://s3.amazonaws.com/datacommons-seeding-us-east/10_Monkey_Species_Small/assets/training.zip"
|
||||
},
|
||||
{
|
||||
checksum: "354d19c0733c47ef3a6cce5b633116b0",
|
||||
checksumType: "MD5",
|
||||
contentLength: 928,
|
||||
url: "https://s3.amazonaws.com/datacommons-seeding-us-east/10_Monkey_Species_Small/assets/monkey_labels.txt"
|
||||
},
|
||||
{
|
||||
url: "https://s3.amazonaws.com/datacommons-seeding-us-east/10_Monkey_Species_Small/assets/validation.zip"
|
||||
}
|
||||
],
|
||||
tags: 'weather, uk, 2011, temperature, humidity',
|
||||
price: 5,
|
||||
type: 'dataset'
|
||||
},
|
||||
curation: {
|
||||
rating: 0,
|
||||
numVotes: 0,
|
||||
schema: 'Binary Voting'
|
||||
},
|
||||
additionalInformation: {
|
||||
updateFrequency: 'yearly'
|
||||
checksum: "",
|
||||
categories: [
|
||||
"image"
|
||||
],
|
||||
tags: [
|
||||
"image data",
|
||||
"classification",
|
||||
"animals"
|
||||
],
|
||||
type: "dataset",
|
||||
description: "EXAMPLE ONLY ",
|
||||
size: "3.1gb",
|
||||
copyrightHolder: "Unknown",
|
||||
encoding: "UTF-8",
|
||||
compression: "zip",
|
||||
workExample: "image path, id, label",
|
||||
links: [
|
||||
{
|
||||
name: "example model",
|
||||
url: "https://drive.google.com/open?id=1uuz50RGiAW8YxRcWeQVgQglZpyAebgSM"
|
||||
},
|
||||
{
|
||||
name: "example code",
|
||||
type: "example code",
|
||||
url: "https://github.com/slothkong/CNN_classification_10_monkey_species"
|
||||
},
|
||||
{
|
||||
url: "https://s3.amazonaws.com/datacommons-seeding-us-east/10_Monkey_Species_Small/links/discovery/n5151.jpg",
|
||||
name: "n5151.jpg",
|
||||
type: "discovery"
|
||||
},
|
||||
{
|
||||
url: "https://s3.amazonaws.com/datacommons-seeding-us-east/10_Monkey_Species_Small/links/sample/sample.zip",
|
||||
name: "sample.zip",
|
||||
type: "sample"
|
||||
}
|
||||
],
|
||||
inLanguage: "en"
|
||||
}
|
||||
}
|
||||
```
|
||||
@ -60,7 +91,7 @@ Now that we have an asset to submit, we need a function to handle it. Just befor
|
||||
async submitAsset() {
|
||||
const accounts = await this.ocean.getAccounts()
|
||||
const ddo = await this.ocean.registerAsset(asset, accounts[0])
|
||||
alert('Asset successfully submited: ', JSON.stringify(ddo))
|
||||
alert('Asset successfully submitted: ', JSON.stringify(ddo))
|
||||
}
|
||||
```
|
||||
|
||||
@ -87,36 +118,67 @@ window.ethereum.enable()
|
||||
|
||||
const asset = {
|
||||
base: {
|
||||
name: 'Office Humidity',
|
||||
description: 'Weather information of UK including temperature and humidity',
|
||||
dateCreated: '2012-02-01T10:55:11+00:00',
|
||||
author: 'Met Office',
|
||||
size: '3.1bg',
|
||||
license: 'Public Domain',
|
||||
copyrightHolder: 'Met Office',
|
||||
contentUrls: [
|
||||
'https://testocnfiles.blob.core.windows.net/testfiles/testzkp.zip'
|
||||
],
|
||||
contentType: 'text/csv',
|
||||
links: [
|
||||
name: "10 Monkey Species Small",
|
||||
dateCreated: "2012-02-01T10:55:11Z",
|
||||
author: "Mario",
|
||||
license: "CC0: Public Domain",
|
||||
contentType: "jpg/txt",
|
||||
price: 10,
|
||||
files: [
|
||||
{
|
||||
name: 'Dataset sample',
|
||||
type: 'sample',
|
||||
url:
|
||||
'http://data.ceda.ac.uk/badc/ukcp09/data/gridded-land-obs/gridded-land-obs-daily/'
|
||||
checksum: "2bf9d229d110d1976cdf85e9f3256c7f",
|
||||
checksumType: "MD5",
|
||||
contentLength: 12057507,
|
||||
url: "https://s3.amazonaws.com/datacommons-seeding-us-east/10_Monkey_Species_Small/assets/training.zip"
|
||||
},
|
||||
{
|
||||
checksum: "354d19c0733c47ef3a6cce5b633116b0",
|
||||
checksumType: "MD5",
|
||||
contentLength: 928,
|
||||
url: "https://s3.amazonaws.com/datacommons-seeding-us-east/10_Monkey_Species_Small/assets/monkey_labels.txt"
|
||||
},
|
||||
{
|
||||
url: "https://s3.amazonaws.com/datacommons-seeding-us-east/10_Monkey_Species_Small/assets/validation.zip"
|
||||
}
|
||||
],
|
||||
tags: 'weather, uk, 2011, temperature, humidity',
|
||||
price: 5,
|
||||
type: 'dataset'
|
||||
},
|
||||
curation: {
|
||||
rating: 0,
|
||||
numVotes: 0,
|
||||
schema: 'Binary Voting'
|
||||
},
|
||||
additionalInformation: {
|
||||
updateFrequency: 'yearly'
|
||||
checksum: "",
|
||||
categories: [
|
||||
"image"
|
||||
],
|
||||
tags: [
|
||||
"image data",
|
||||
"classification",
|
||||
"animals"
|
||||
],
|
||||
type: "dataset",
|
||||
description: "EXAMPLE ONLY ",
|
||||
size: "3.1gb",
|
||||
copyrightHolder: "Unknown",
|
||||
encoding: "UTF-8",
|
||||
compression: "zip",
|
||||
workExample: "image path, id, label",
|
||||
links: [
|
||||
{
|
||||
name: "example model",
|
||||
url: "https://drive.google.com/open?id=1uuz50RGiAW8YxRcWeQVgQglZpyAebgSM"
|
||||
},
|
||||
{
|
||||
name: "example code",
|
||||
type: "example code",
|
||||
url: "https://github.com/slothkong/CNN_classification_10_monkey_species"
|
||||
},
|
||||
{
|
||||
url: "https://s3.amazonaws.com/datacommons-seeding-us-east/10_Monkey_Species_Small/links/discovery/n5151.jpg",
|
||||
name: "n5151.jpg",
|
||||
type: "discovery"
|
||||
},
|
||||
{
|
||||
url: "https://s3.amazonaws.com/datacommons-seeding-us-east/10_Monkey_Species_Small/links/sample/sample.zip",
|
||||
name: "sample.zip",
|
||||
type: "sample"
|
||||
}
|
||||
],
|
||||
inLanguage: "en"
|
||||
}
|
||||
}
|
||||
|
||||
@ -139,7 +201,7 @@ class App extends Component {
|
||||
async submitAsset() {
|
||||
const accounts = await this.ocean.getAccounts()
|
||||
const ddo = await this.ocean.registerAsset(asset, accounts[0])
|
||||
alert('Asset successfully submited: ', JSON.stringify(ddo))
|
||||
alert('Asset successfully submitted: ', JSON.stringify(ddo))
|
||||
}
|
||||
|
||||
render() {
|
||||
|
Loading…
Reference in New Issue
Block a user