theSage21 / handwritten

Plain text to handwriting generator.
http://thesage21.github.io/handwritten/
MIT License
216 stars 64 forks source link

Syntax error #7

Closed antoniouras closed 6 years ago

antoniouras commented 6 years ago

Dear developers, I find an error when running the simple example provided in the doc:

python get_hand.py -t "Homework could have been easier" -s 2 -c 0,0,200 -b 0.85

File "get_hand.py", line 51 print('.', end='') ^ SyntaxError: invalid syntax

Do you have any hint?

Best regards, Antonio

theSage21 commented 6 years ago

This could possibly be coming from the use of python 2.7

On 30-Jan-2018 00:37, "antoniouras" notifications@github.com wrote:

Dear developers, I find an error when running the simple example provided in the doc:

python get_hand.py -t "Homework could have been easier" -s 2 -c 0,0,200 -b 0.85

File "get_hand.py", line 51 print('.', end='') ^ SyntaxError: invalid syntax

Do you have any hint?

Best regards, Antonio

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/theSage21/handwritten/issues/7, or mute the thread https://github.com/notifications/unsubscribe-auth/AHVj0T-mR4XiW7vtwBhMCJ3qwayF5CfBks5tPhbfgaJpZM4RxMPf .

antoniouras commented 6 years ago

Thanks... is there anything I can do to overcome the problem?

theSage21 commented 6 years ago

You can install python 3.x That should take care of the problem.

On 31-Jan-2018 16:26, "antoniouras" notifications@github.com wrote:

Thanks... is there anything I can do to overcome the problem?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/theSage21/handwritten/issues/7#issuecomment-361897134, or mute the thread https://github.com/notifications/unsubscribe-auth/AHVj0RoZ0mugho6IVrjl-kfaUZzejEkvks5tQEbZgaJpZM4RxMPf .

antoniouras commented 6 years ago

Thanks, I've installed python3, now I get this message:

Traceback (most recent call last): File "get_hand.py", line 5, in import requests ModuleNotFoundError: No module named 'requests'

Shall I install anything else?

theSage21 commented 6 years ago

Hmm. I missed adding this to the README. You need to install requests and Pillow to run the demo.

antoniouras commented 6 years ago

Thanks, now the script starts doing its job! However, I still don't manage to get the output figure:

...... Creating images folder Starting handwriting generation

0 - Homework could have been easier.Traceback (most recent call last): File "get_hand.py", line 111, in command_line() File "get_hand.py", line 105, in command_line add_color(color, image_out) File "get_hand.py", line 60, in add_color img = Image.open(image_out) File "/usr/local/lib/python3.6/site-packages/PIL/Image.py", line 2585, in open % (filename if filename else fp)) OSError: cannot identify image file 'images/0.png'

The file images/0.png is created, but it is not readable. Am I missing something?

theSage21 commented 6 years ago

Hmm. I haven't faced this before.

antoniouras commented 6 years ago

If it can help, I work on Mac Sierra 10.12.6...

theSage21 commented 6 years ago

Are you able to open it with some kind of image viewer?

antoniouras commented 6 years ago

No... the message is always that the file is damaged or corrupted.

theSage21 commented 6 years ago

In that case it's probably not getting written properly. I last verified this before the code was updated for color. Can @ritiek help out?

ritiek commented 6 years ago

Sorry, I am a bit busy at the moment. I'll investigate more on this soon.

BTW, I think this is a problem with saving the generated image locally (and not with color option, I guess). @antoniouras Can you try running the same command but replacing color option with -c 0,0,0?

antoniouras commented 6 years ago

Hello, sorry for the delay! Thanks for the suggestion, I've tried with the -c 0,0,0 option and I have the following output messages:

Starting handwriting generation 0 - Homework could have been easier.|

Apparently, no error message this time. However, the output file is still not readable (file damaged). I'm attaching it to the this message, in case it could be useful. Here it is: 0

ritiek commented 6 years ago

Is it just me or is something wrong with http://www.cs.toronto.edu/~graves/handwriting.cgi (does not generate handwriting anymore)?

theSage21 commented 6 years ago

I haven't checked. It might have gone down.

antoniouras commented 6 years ago

I confirm, the http://www.cs.toronto.edu/~graves/handwriting.cgi generator doesn't work...

theSage21 commented 6 years ago

Hmm. I don't have a free server right now to host the actual neural net. I've mailed Graves about this. Let's see what turns up. Otherwise we could write a small net and put it in this repo, thereby eliminating the network calls.

fleuryfontaine commented 6 years ago

Hi, I have the same problem than @antoniouras the png is corrupted. I'm on PC, windows 8 with python 3.6.4 I was a fan of Graves website and was really happy to find out you did a easy usable version it's a great idea ! Hope you can find a fix, good luck.

theSage21 commented 6 years ago

Since Graves' site is down and there has been no reply so far to queries; I've created a free heroku app for now. It's slow but it gets the job done. I haven't tested for full backward compatibility though so @fleuryfontaine and @antoniouras, you might want to open new issues regarding the new server.

Go easy on it though :smile: it isn't a big machine.