Skip to content

Commit

Permalink
Merge pull request #31 from thisisankit27/pre-deploy
Browse files Browse the repository at this point in the history
OCR Added + Visual Elocution Imoproved Response Time
  • Loading branch information
thisisankit27 authored Feb 12, 2024
2 parents c23c699 + 1969834 commit 3e38392
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions MasterProject/MasterProject/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import environ
import os

os.environ['CUDA_VISIBLE_DEVICES'] = ''
env = environ.Env()
environ.Env.read_env()

Expand Down
2 changes: 1 addition & 1 deletion MasterProject/homeapp/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ def generate_caption_for_image(image):
# image = Image.open(image_path)
photo = extract_features(image, xception_model)
caption = generate_caption(model, tokenizer, photo, max_length)
return caption, image
return caption
10 changes: 7 additions & 3 deletions MasterProject/homeapp/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,18 @@ def upload_image_view(request):

# Captioning Function calls START here:

captions, _ = generate_caption_for_image(image)
captions = generate_caption_for_image(image)

# Captioning function calls END here

# ocrText = perform_ocr(image)
ocrText = perform_ocr(image)
if (ocrText == ""):
ocrText = "No Text Found"

contcatenated = "Visual Elocution: " + captions + "\n" + "OCR: " + ocrText

# return a response if needed
return JsonResponse({'status': 'success', 'message': captions})
return JsonResponse({'status': 'success', 'message': contcatenated})
# return JsonResponse({'status': 'success', 'message': ocrText, 'captions': captions})

return JsonResponse({'status': 'error', 'message': 'Invalid request method'})

0 comments on commit 3e38392

Please sign in to comment.