samila/test/nft_upload_test.py

30 wiersze
745 B
Python
Czysty Zwykły widok Historia

2021-10-12 18:04:17 +00:00
# -*- coding: utf-8 -*-
"""
>>> import os
>>> import math
>>> import random
2021-10-12 18:15:05 +00:00
>>> import time
>>> from samila import GenerativeImage
2021-10-12 18:04:17 +00:00
>>> def f1(x,y):
... result = random.uniform(-1,1) * x**2 - math.sin(y**2) + abs(y-x)
... return result
>>> def f2(x,y):
... result = random.uniform(-1,1) * y**3 - math.cos(x**2) + 2*x
... return result
>>> g = GenerativeImage(f1,f2)
>>> g.generate()
>>> g.plot()
>>> NFT_STORAGE_API_KEY = os.environ["NFT_STORAGE_API_KEY"]
>>> g.generate()
>>> g.plot()
2021-10-12 18:15:05 +00:00
>>> counter = 0
>>> try_limit = 3
>>> status = False
>>> while(status == False and counter<try_limit):
... result = g.nft_storage(api_key=NFT_STORAGE_API_KEY)
... counter = counter + 1
... status = result["status"]
>>> status
2021-10-12 18:04:17 +00:00
True
"""