Skip to content

Abhiswain97/Hindi-Character-Recognition

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hindi-Character-Recognition

The app is live on huggingface spaces! Try it -> Gradio-HCR

I also created this project as to understand the difference Pytorch Lightning makes v/s writing the code in pure Pytorch. You can see it for yourself:

  1. Code in Pytorch Lightning -> Lightning.py
  2. Code in pure Pytorch -> all the files under src folder

Running the app locally:

You can run the streamlit and gradio app locally.

  1. Install the requirements: pip install -r requirements.txt

  2. Now, just do streamlit run app.py or gradio gradio_app.py

Streamlit demo

App

Gradio demo

GradioApp

Training the model (Optional)

  1. Install the requirements: pip install -r requirements.txt

  2. Hindi Character Recognition

    Getting the data:

    • Download the data from here
    • Unzip it. You need to split the data into 4 different directories, since we are training for Hindi digits & letters separately. image

    How to run ?

    • You can create your custom model in the model.py file or can go with the HNet already present. For custom models created, you need to import them to train.py, for them to to use. Remember we are training different models for Hindi Digit & Characters.
    • Now to train the model with default params do, python train.py. You can also specify epochs and lr. Most important, is the model_type
    • To train do, python train.py --epochs <num-epochs> --lr <learning-rate> --model_type <type-of-model>