Skip to content

Python3 compatibility #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions fauxtograph/fauxto.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import click
from fauxtograph import VAE, image_resize, get_paths
from BeautifulSoup import BeautifulSoup
from bs4 import BeautifulSoup
import requests as r
import os
import numpy as np
Expand Down Expand Up @@ -49,7 +49,7 @@ def download_page(filepath, url, pic_type, page):
img = img_data.content
numb_str = '{0}{1}_{2}.jpg'.format(pic_type, page, i)
path = os.path.join(filepath, numb_str)
with open(path, 'w') as f:
with open(path, 'wb') as f:
f.write(img)


Expand Down
7 changes: 5 additions & 2 deletions fauxtograph/fauxtograph.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
from __future__ import absolute_import # For Python 2/3 compatibility

from PIL import Image
import chainer.functions as F
from chainer import Variable
import chainer.optimizers as O
from chainer import serializers
import matplotlib.pyplot as plt
from vaegan import *
from .vaegan import *
import tqdm
import time
import numpy as np
import os
from IPython.display import display
import json
from functools import reduce


class VAE(object):
Expand Down Expand Up @@ -118,7 +121,7 @@ def _save_meta(self, filepath):
d.pop('opt')
# d.pop('xp')
meta = json.dumps(d)
with open(filepath+'.json', 'wb') as f:
with open(filepath+'.json', 'w') as f:
f.write(meta)

def transform(self, data, test=False):
Expand Down
1 change: 1 addition & 0 deletions fauxtograph/vaegan.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from chainer import Variable
import chainer
import numpy as np
from functools import reduce


class Encoder(chainer.Chain):
Expand Down
3 changes: 1 addition & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
appnope==0.1.0
BeautifulSoup==3.2.1
beautifulsoup4==4.4.1
chainer==1.6.0
click==5.1
decorator==4.0.2
fauxtograph==0.2.0
funcsigs==0.4
gnureadline==6.3.3
ipython==4.0.0
Expand Down
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name='fauxtograph',
version='1.0.3',
version='1.0.4',
author='TJ Torres',
author_email='[email protected]',
license='MIT',
Expand Down Expand Up @@ -33,11 +33,12 @@
'pillow',
'joblib',
'tqdm',
'BeautifulSoup',
'beautifulsoup4',
'requests',
'numpy',
'click>=5.0',
'matplotlib',
'jupyter',
],
entry_points={
'console_scripts': [
Expand Down