Skip to content

Commit

Permalink
Cnn stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Dhvani Patel committed Jul 25, 2017
1 parent 2997db2 commit 390a4a8
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 1 deletion.
Binary file modified Token.pyc
Binary file not shown.
Binary file modified __pycache__/toCheck.pypy-41.pyc
Binary file not shown.
Binary file modified check_pypy_syntax.pyc
Binary file not shown.
24 changes: 23 additions & 1 deletion cnn_hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
import keyword
from Token import Token
import json
from pylab import imshow, show, get_cmap
import numpy as np
from PIL import Image

global all_tokens

Expand Down Expand Up @@ -159,6 +162,7 @@ def create(numFile):
text = (all_rows[numFile][0]).decode('utf-8')
print (type(text))
tokenStream = tokenize.generate_tokens(StringIO(text).readline)
print (tokenize.tok_name)
for tok in tokenStream:
all_tokens.append([tok.exact_type, tokenize.tok_name[tok.exact_type], tok[2], tok[3], tok[4]])
#print (tok)
Expand All @@ -181,7 +185,25 @@ def create(numFile):
num_lines = len(set(lines))
print (num_lines)
print (maxCol)

imageArrOne = [-1] * maxCol
a = []
for _ in range(num_lines):
a.append(imageArrOne)


#a = np.column_stack((imageArrOne, imageArrTwo))
#print (a.shape)
#imshow([[0], [1], [0]], cmap=get_cmap("Spectral"), interpolation='none')
#show()
im = Image.new("RGB", (maxCol, num_lines))
pix = im.load()
for x in range(maxCol):
for y in range(num_lines):
pix[x,y] = (255,255,255)
pix[5,6] = (255,0,0)
im.save("test.png", "PNG")

#print all_text

#print one_hot_good
Expand All @@ -192,6 +214,6 @@ def create(numFile):


if __name__ == '__main__':
create(2)
create(4)
#for x in range(10):
#create(x)

0 comments on commit 390a4a8

Please sign in to comment.