<jupyter_start><jupyter_text>Imports<jupyter_code>from contracts_lib_py.account import Account
from nevermined_sdk_py import Config, Nevermined

import utils

PROVIDER_ADDRESS = "0x068Ed00cF0441e4829D9784fCBe7b9e26D4BD8d0"
PROVIDER_PASSWORD = "<PASSWORD>"
PROVIDER_KEYFILE = "../resources/accounts/provider.json"
CONFIG_FILE = "../config.ini"

URL_DATASET_1 = [
    "https://github.com/nevermined-io/fl-demo/raw/master/image-classification-flower/resources/data/x_test_0.npy",
    "https://github.com/nevermined-io/fl-demo/raw/master/image-classification-flower/resources/data/y_test_0.npy",
    "https://github.com/nevermined-io/fl-demo/raw/master/image-classification-flower/resources/data/x_train_0.npy",
    "https://github.com/nevermined-io/fl-demo/raw/master/image-classification-flower/resources/data/y_train_0.npy",
]

URL_DATASET_2 = [
    "https://github.com/nevermined-io/fl-demo/raw/master/image-classification-flower/resources/data/x_test_1.npy",
    "https://github.com/nevermined-io/fl-demo/raw/master/image-classification-flower/resources/data/y_test_1.npy",
    "https://github.com/nevermined-io/fl-demo/raw/master/image-classification-flower/resources/data/x_train_1.npy",
    "https://github.com/nevermined-io/fl-demo/raw/master/image-classification-flower/resources/data/y_train_1.npy",
]<jupyter_output><empty_output><jupyter_text>Setup Nevermined and Accounts<jupyter_code>nevermined = Nevermined(Config(CONFIG_FILE))

provider_account = Account(PROVIDER_ADDRESS, PROVIDER_PASSWORD, PROVIDER_KEYFILE)<jupyter_output><empty_output><jupyter_text>Publish compute to the data for both data assets<jupyter_code># Dataset 1
metadata_compute1 = {
  "main": {
    "name": "CIFAR-10 Part 1",
    "dateCreated": utils.date_now(),
    "author": "Nevermined Provider",
    "license": "",
    "price": "1",
    "files": [],
    "type": "dataset"
  }
}

for i, url in enumerate(URL_DATASET_1):
    file_ = {
        "index": i,
        "contentType": "application/octet-stream",
        "checksum": "0x52b5c93b82dd9e7ecc3d9fdf4755f7f69a54484941897dc517b4adfe3bbc3377",
        "checksumType": "MD5",
        "contentLength": "12057507",
        "url": url
    }
    metadata_compute1["main"]["files"].append(file_)

utils.print_json(metadata_compute1)
ddo_compute1 = nevermined.assets.create_compute(metadata_compute1, provider_account)
print(f"Compute DID: {ddo_compute1.did}")
# Dataset 1
metadata_compute2 = {
  "main": {
    "name": "CIFAR-10 Part 2",
    "dateCreated": utils.date_now(),
    "author": "Nevermined Provider",
    "license": "",
    "price": "1",
    "files": [],
    "type": "dataset"
  }
}

for i, url in enumerate(URL_DATASET_2):
    file_ = {
        "index": i,
        "contentType": "application/octet-stream",
        "checksum": "0x52b5c93b82dd9e7ecc3d9fdf4755f7f69a54484941897dc517b4adfe3bbc3377",
        "checksumType": "MD5",
        "contentLength": "12057507",
        "url": url
    }
    metadata_compute2["main"]["files"].append(file_)

utils.print_json(metadata_compute2)
ddo_compute2 = nevermined.assets.create_compute(metadata_compute2, provider_account)
print(f"Compute DID: {ddo_compute2.did}")<jupyter_output><empty_output><jupyter_text>Publish the coordinator serviceThis service does not provide any data. It only provides compute by hosting the coordinator.<jupyter_code>metadata_flwr_service = {
  "main": {
    "name": "Flower Service",
    "dateCreated": utils.date_now(),
    "author": "Adap",
    "license": "",
    "price": "1",
    "files": [],
    "type": "compute"
  }
}
ddo_compute_flwr = nevermined.assets.create_compute(metadata_flwr_service, provider_account)
print(f"Compute DID: {ddo_compute_flwr.did}")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14636780988387793, 'fraction_numerical': 0.04212800432082096, 'mean_word_length': 4.833070866141732, 'pattern_counts': {'":': 36, '<': 18, '<?xml version=': 0, '>': 18, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '207069', 'license': 'Apache-2.0', 'n_tokens_mistral': 1441, 'n_tokens_neox': 1376, 'n_words': 173, 'path': 'image-classification-flower/notebooks/nevermined_provider.ipynb', 'repo_name': 'nevermined-io/fl-demo', 'size': '3699'}