Giter Site home page Giter Site logo

ceviess / tgvoice2text Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 12 KB

A Telegram bot that processes voice messages using Sber's speech recognition API. This bot converts audio formats, generates authentication tokens, and transcribes voice messages into text, enabling seamless communication via Telegram.

License: Apache License 2.0

Python 95.10% Dockerfile 4.90%
audio-conversion chatbots python speech-recognition telegram-api telegram-bot text-to-speech voice-processing sber-api

tgvoice2text's Introduction

Telegram Voice Message Processor

Module for processing voice messages and utilizing Sber's speech recognition API.

Overview

This module contains functions to handle voice messages received by a Telegram bot. It performs various operations, including converting audio formats, acquiring authentication tokens, and using Sber's speech recognition API to convert audio to text.

Functions

- process_voice_message(update: telegram.Update, context: telegram.ext.CallbackContext) -> 

None: Process a voice message from a Telegram update.
- convert_ogg_to_mp3() -> None: Convert an OGG audio file to MP3 format.
- get_token() -> dict: Obtain an authentication token for API access.
- convert_audio_to_text() -> str: Convert audio to text using Sber's speech recognition API.
- main() -> None: Main function to run the Telegram bot application.

Files

bot.py
constants.py
utils.py

Setup

Requirements

Python version 3.10.13
Docker version 24.0.7

Installation

  1. Clone the repository.
  2. Set up environment variables.
    - BOT_TOKEN: telegram bot token
    - CLIENT_SECRET: client secret obtained at developers.sber.ru
  3. Build the Docker image:
docker build -t project-name .
  1. Run the Docker container:
docker run -e BOT_TOKEN=$BOT_TOKEN -e CLIENT_SECRET:$CLIENT_SECRET project-name

Usage

Once the application is running, interact with your Telegram bot by sending voice messages. The bot will process these messages and reply with converted text.

Configuration

Ensure the following configurations are set up:
Environment Variables:
BOT_TOKEN: Telegram Bot token.
CLIENT_SECRET: Sber's client secret for authentication.

Contributing

Contributions to this project are welcome. To contribute:

  1. Fork the repository to your GitHub account.
  2. Create a new branch for your feature or bug fix.
  3. Make changes and test thoroughly.
  4. Commit your changes with descriptive commit messages.
  5. Push your changes to your fork.
  6. Open a pull request to the main repository's branch.

License

This project is licensed under Apache License Version 2.0, January 2004

Acknowledgements

This project uses the following resources:

python-telegram-bot: Library for interacting with Telegram API.
pydub: Library for audio manipulation.
requests: Library for making HTTP requests.
(Add any other libraries or resources used in your project.)

tgvoice2text's People

Contributors

ceviess avatar

Watchers

 avatar

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.