[FIXED] Clone of style transfer failing url request type

Decided to clone and test this project below ran into a small error. Looks like an issue with url.
I have just tested this for python 3.6, 3.7, 3.8 would not build requirement versions. To rule out version differences in url libraries.

Cloned the [Blog] Turning Photos into Paintings app in anvil.

added uplink key to script.
Created conda virutal env python=3.7
pip install -r requirements.txt
python neural-style-transfer.py
create photo in app get back following

TypeError: expected string or bytes-like object at
/home/will/anaconda3/envs/anvil_st/lib/python3.7/urllib/parse.py, 
line 983 called from 
/home/will/anaconda3/envs/anvil_st/lib/python3.7/urllib/request.py, 
line 245 called from neural-style-
transfer.py, line 221 called from [Homepage, line 36](javascript:void(0))

line 221 is the content path line, may be issue with the byte string sent etc.

@anvil.server.callable
def run_style_transfer(content_image_url,
                       style_image_url,
                       images_row,
                       num_iterations=1000,
                       content_weight=1e3,
                       style_weight=1e-2):


  content_path = urllib.request.urlretrieve(content_image_url, img_dir + "/content-layer.jpg")[0]

Hi @smitswil,

Thanks for the helpful information and error traceback. This was a bug in the script which has now been fixed - if you download the files again from the blog post, everything should be working now :slight_smile:

Updated zip file: https://anvil.works/blog/img/turning-photos-into-paintings/script-and-requirements.zip