ghanender-chauhan / Text-to-handwritting-OSF

3 stars 1 forks source link

Suggestions and Fixes #14

Open sahil-ramagiri opened 3 years ago

sahil-ramagiri commented 3 years ago
  1. Code duplication
    • Why do we have seperate files containing same code. We could prevent it by writing reusable components with module system.
  2. Django was an overkill
    • Using django was really a overkill, it could have been just a single page flask app, instead of adding whole django as dependency and under utilizing it.
  3. Django runs in blocking mode
    • While the image is being generated, it doesn't serve other requests. This could have been prevented by offloading heavy tasks to separate thread or using asynchronous methods.
  4. Font rendering is not just stitching images together
    • Each glyph/(image of character) has data associated with it that governs it's behavior about positioning with respect to other.
    • So I would suggest two routes:
      1. Make fonts that follow standards and render them using any font rendering engine. This font can be used any where and will be performant.
      2. Make own rendering engine that follows only limited standards and custom requirements but leave performance and as a good learning exercise.
ghanender-chauhan commented 3 years ago
  1. Code duplication

    • Why do we have seperate files containing same code. We could prevent it by writing reusable components with module system.
  2. Django was an overkill

    • Using django was really a overkill, it could have been just a single page flask app, instead of adding whole django as dependency and under utilizing it.
  3. Django runs in blocking mode

    • While the image is being generated, it doesn't serve other requests. This could have been prevented by offloading heavy tasks to separate thread or using asynchronous methods.
  4. Font rendering is not just stitching images together

    • Each glyph/(image of character) has data associated with it that governs it's behavior about positioning with respect to other.
    • So I would suggest two routes:

      1. Make fonts that follow standards and render them using any font rendering engine. This font can be used any where and will be performant.
      2. Make own rendering engine that follows only limited standards and custom requirements but leave performance and as a good learning exercise.

Ok So...you want to work on this issue ??

sahil-ramagiri commented 3 years ago

Yeah if you can seperate out issues and assign then I can

av1shek commented 3 years ago

@sahil-ramagiri @ghanender-chauhan can you give me idea about point 2 "Django runs in blocking mode" how can we solve this, but let me assure I will not work on this in contest if you are worry about points. Pls try to explain in details also about point 4 "Make fonts that follow standards and render them using any font rendering engine" how we can achieve this ?

sahil-ramagiri commented 3 years ago

For point 2 the simplest solution I can think of is to, take the job from client and send the client a link where the result will be showed upon completion. Meanwhile the server can do its stuff and serve others. The user can go to the link and wait until the job is done.

sahil-ramagiri commented 3 years ago

For point 4 lookup how to make custom fonts, there's something called kerning and some libraries allow you to do this.

Siddharth1006 commented 3 years ago

@sahil-ramagiri Your thought process is quite great. Never thought of the same project from your perspective. Since, I am new to this I just wanted to know your approach on (point-1). How do you intend to remove code duplication? Could you please elaborate on it? And what do you mean by a module system?

sahil-ramagiri commented 3 years ago

You can restructure the code so that the image generation part is in a library/module (which are just files you can import from) and then import the function in your business logic part of the web app and call it with data. That way different parts of code are isolated and you can use either the cli version or web version with same code and no duplication.

Siddharth1006 commented 3 years ago

Understood.

ghanender-chauhan commented 3 years ago

@sahil-ramagiri @ghanender-chauhan can you give me idea about point 2 "Django runs in blocking mode" how can we solve this, but let me assure I will not work on this in contest if you are worry about points. Pls try to explain in details also about point 4 "Make fonts that follow standards and render them using any font rendering engine" how we can achieve this ?

Actually I also didn't get this.... I m only thinking about this nd trying to resolve this.. but @sahil-ramagiri If you want to look up into this issues which you mentioned you can work on that . I will also learn some new things from you ....

sahil-ramagiri commented 3 years ago

Sure, first I'll have to learn the django way of doing stuff.

av1shek commented 3 years ago

For point 2 the simplest solution I can think of is to, take the job from client and send the client a link where the result will be showed upon completion. Meanwhile the server can do its stuff and serve others. The user can go to the link and wait until the job is done.

Ok but then we have to store all the images in our backend I thought of doing this it is easy every time we have to save the results with different name, but I thought it is not a good idea but I will think about it.

Siddharth1006 commented 3 years ago

For point 2 the simplest solution I can think of is to, take the job from client and send the client a link where the result will be showed upon completion. Meanwhile the server can do its stuff and serve others. The user can go to the link and wait until the job is done.

Ok but then we have to store all the images in our backend I thought of doing this it is easy every time we have to save the results with different name, but I thought it is not a good idea but I will think about it.

I can see why you thought renaming files can't be a good idea. Just wanted to know did you get a thought of any other approach to tackle the issue other than renaming?

harry-dev98 commented 3 years ago
  1. Django runs in blocking mode

    • While the image is being generated, it doesn't serve other requests. This could have been prevented by offloading heavy tasks to separate thread or using asynchronous methods.

Django does not run in blocking mode.. in django 3 we have async views,also can expect async orm soon in futher releases.

May be the code need to be modified if image generation blocks the other requests.

ghanender-chauhan commented 3 years ago

Sure, first I'll have to learn the django way of doing stuff.

@sahil-ramagiri have u done something??