Skip to content

πŸš€ Unleash the power of object detection on Telegram! This repository hosts the code for a Telegram bot that effortlessly identifies objects in user-uploaded images using YOLOv5.

Notifications You must be signed in to change notification settings

IbraheemGanayim/DetectiveBot-YOLOv5-Telegram

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

9 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

DetectiveBot-YOLOv5-Telegram

Leveraging YOLOv5, Flask, Telegram API, and Ngrok, this project delivers a Dockerized solution for image object detection via a user-friendly chat-based interface. The Object Detection Telegram Bot utilizes the Telegram Bot API to seamlessly receive user images and provide swift responses with detected objects.

Table of Contents

Implementation Guidelines - polybot Microservice

Running the Telegram Bot Locally

The Telegram app, implemented in Flask, serves as a chat-based interface for users to interact with image object detection functionality.

Prerequisites

  • Python environment
  • Docker

Steps

  1. Clone the Repository:

    git clone https://github.com/ibraheemGanayim/DetectiveBot-YOLOv5-Telegram.git
    cd DetectiveBot-YOLOv5-Telegram
  2. Build and Run the Docker Containers:

    docker-compose up --build
  3. Set Up Ngrok for Secure Tunneling:

    • Sign up for Ngrok and install the Ngrok agent.
    • Authenticate Ngrok with your authtoken:
      ngrok config add-authtoken <your-authtoken>
    • Start Ngrok to expose the local server:
      ngrok http 8443
    • Obtain the Ngrok public URL (e.g., https://16ae-2a06-c701-4501-3a00-ecce-30e9-3e61-3069.ngrok-free.app).
    • Set the TELEGRAM_APP_URL environment variable to your Ngrok URL.
  4. Test the Echo Bot:

    • The default behavior echoes incoming messages. Try it out!
  5. Extend with QuoteBot:

    • Change the instantiated instance in app.py:
      - Bot(TELEGRAM_TOKEN, TELEGRAM_APP_URL)
      + QuoteBot(TELEGRAM_TOKEN, TELEGRAM_APP_URL)

Extending with ObjectDetectionBot

The ObjectDetectionBot class in bot.py handles incoming messages for image object detection.

  • Change the instantiated instance in app.py:

    - Bot(TELEGRAM_TOKEN, TELEGRAM_APP_URL)
    + ObjectDetectionBot(TELEGRAM_TOKEN, TELEGRAM_APP_URL)
  • Run the Object Detection Bot:

    • Start Ngrok to expose the local server:
      ngrok http 8443
    • Start the other services:
      docker-compose up --build
    • Send an image to the bot and observe the results.

Feel free to customize and enhance the project based on your needs. Contributions are welcome!

About

πŸš€ Unleash the power of object detection on Telegram! This repository hosts the code for a Telegram bot that effortlessly identifies objects in user-uploaded images using YOLOv5.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published