Code Monkey home page Code Monkey logo

discord-ocr-bot's Introduction

OCR - Bot

A Simple Discord Bot for OCR which is enabled by pytesseract library. Deployable on Heroku (steps to deploy below).

If you just want to add an OCR bot on your server , use this OCR-Bot on top.gg.

As a personal preference, this bot requires no command to do OCR. So add it to a separate channel and make sure other channels are not visible to it.

Instructions:

  • Clone the repo

  • Install all the requirements

    pip install -r requirements.txt
  • These requirements include "opencv-headless", if you are trying it on a machine which doesn't support it, install the normal OpenCV library.

  • Install tesserct-ocr using this command:

    • On Ubuntu
      sudo apt-get install tesseract-ocr
      
    • On Mac
      brew install tesseract
      
    • On Windows, download installer from here
  • Don't forget to add your "BOT_TOKEN" in the "bot.py" file.

  • Run the python bot using the command:

    python bot.py

    or

    python3 bot.py


Deploying on Heroku (as on Feb-2021)

  • Uncomment the line as shown below before deploying to Heroku:

  • Create an account on Heroku

  • Click on "New" -> "Create new App"

  • When you click on "Create App", you'll be greeted with this section :

  • Jump to "Settings" where you'll scroll down to see "Config Vars" & "Buildpacks":

  • Add "Python Buildpack" and the below mentioned buildpack :

    https://github.com/heroku/heroku-buildpack-apt


  • After adding both buildpacks, click on "Reveal Config Vars" :

  • Add the below mentioned "Key = Value" Pair :

    TESSDATA_PREFIX = ./.apt/usr/share/tesseract-ocr/4.00/tessdata

  • After adding both Buildpacks and Config variables, we're now ready to deploy.

  • Follow the Steps given in "Deploy" section of your Heroku app.

  • But, First we have to change the Heroku stack to "heroku-18"

    • Changing it to "heroku-18" made it work for me.

    • Type in the first three commands in your bot directory (assuming you have heroku CLI installed) :

    heroku login
    git init
    heroku git:remote -a "Your-app-name"

    • Before the "git add ." command, use this command to change the stack to "heroku-18"

      heroku stack:set heroku-18

    • Then you can proceed with the commands :
    git add .
    git commit -am "make it better"
    git push heroku master

  • It'll take time to push the bot to heroku. Be patient.

  • After the build has succeeded, you can go and start your bot by going into "resources" tab and turning the "bot.py" worker ON.

    • Click on the edit icon and turn the bot ON.

That's it, your bot is now live. (If you didn't forget to add your "BOT_TOKEN" in the bot.py file.)

discord-ocr-bot's People

Contributors

goldenryu2000 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

discord-ocr-bot's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.