1
0
Fork 0
mirror of https://github.com/Findus23/nonsense.git synced 2024-09-19 16:03:50 +02:00

use numpy for ikeagen

This commit is contained in:
Lukas Winkler 2018-01-30 15:14:26 +01:00
parent 03002d4335
commit e20e46db8b
No known key found for this signature in database
GPG key ID: 94AFBE7C2656A5B5
3 changed files with 33 additions and 20 deletions

1
.gitignore vendored
View file

@ -5,5 +5,6 @@ tmp
!public/icons/manifest.json
*.yaml
*.pickle
*.npy
__pycache__/
config.py

View file

@ -1,6 +1,6 @@
#!/usr/bin/python3
import pickle
import numpy as np
import os
import random
from PIL import Image
@ -9,7 +9,8 @@ import utils
def gen():
table = [[[0 for i in range(221)] for j in range(221)] for k in range(221)]
n = 221
table = np.empty(shape=(n, n, n), dtype=np.int)
crawldata = utils.crawl_data()
names = {result["name"] for result in crawldata}
count = 0
@ -27,17 +28,6 @@ def gen():
return table, count
def save(data):
with open('ikeaname.pickle', 'wb') as outfile:
pickle.dump(data, outfile, pickle.HIGHEST_PROTOCOL)
def load():
with open('ikeaname.pickle', "rb") as inputfile:
table = pickle.load(inputfile)
return table
def letter(a, b):
mylist = []
for c in range(221):
@ -62,13 +52,11 @@ def image(table):
img.save('image.png')
if os.path.isfile('ikeaname.pickle'):
table, count = load()
# image(table)
if os.path.isfile('ikeaname.npy') and False: # Loading uses twice the memory and is therefore disabled
table, count = np.load('ikeaname.npy')
else:
table, count = gen()
save((table, count))
np.save('ikeaname.npy', (table, count), )
def generate():

View file

@ -1,17 +1,41 @@
numpy
asn1crypto==0.24.0
attrs==17.4.0
Automat==0.6.0
beautifulsoup4==4.6.0
certifi==2017.11.5
cffi==1.11.2
chardet==3.0.4
click==6.7
constantly==15.1.0
cryptography==2.1.4
cssselect==1.0.3
Flask==0.12.2
future==0.16.0
hyperlink==17.3.1
idna==2.6
incremental==17.5.0
itsdangerous==0.24
Jinja2==2.10
lxml==4.1.1
MarkupSafe==1.0
olefile==0.44
Pillow==4.3.0
parsel==1.3.1
Pillow==5.0.0
pyasn1==0.4.2
pyasn1-modules==0.2.1
pycparser==2.18
PyDispatcher==2.0.5
pyOpenSSL==17.5.0
python-telegram-bot==9.0.0
PyYAML==3.12
queuelib==1.4.2
requests==2.18.4
Scrapy==1.5.0
service-identity==17.0.0
six==1.11.0
Twisted==17.9.0
urllib3==1.22
Werkzeug==0.13
w3lib==1.18.0
Werkzeug==0.14.1
zope.interface==4.4.3