I make an OCR application which take an input image from user and do this following steps (In order):
- Image Processing
- Bounding Box
- Character Segmentation
- Predicting each characters
But Since this all above steps is taking too much time, so I decided to implement a progress bar which show how much process is done to users. But I am new to Django and I read about celery-progress-bar. Ans I can't figure out how do I use this in my app.
Here is what I thought, what my view.py should look like:
def my_function(request):
# Here I want to start progress bar
....
cleared_image = image_processing(image) # Image Processing
segmented = character_segmentation(cleared_image) # Segmented Characters as list (in sorted)
.....
predicted = [] # This list will store prediction of each character
for character in segmented:
....
prediction = predict(obj.picture)
predicted.append(prediction)
### Here I want to Update Progress bar
....
def image_processing(image):
# Correct skew and Do Image Processing
### Here I want to Update Progress bar
return resulted_image
def character_segmentation(image):
#Do Bounding Box and character Segmentation
### Here I want to Update Progress bar
return list_of_characters