Giter VIP home page Giter VIP logo

kyumnii's Introduction

kyumnii

wow

Some info about kyumnii.

A Twitch Chat AI that reads twitch chat and creates a text to speech response using Google Cloud API and OpenAI's GPT-3 text completion model.

Kyumnii is coded in Python.

I use TwitchIO, A fully asynchronous Python IRC, API, EventSub and PubSub library for Twitch to check for messages, pull the contents and feeds it to GPT-3 where it responds.

There is a profanity filter that uses the Jaro-Winkler distance algorithm thats used to detect whether a given message or response contains profanity. It checks the similarity of the given message or response to a list of profanity words stored.

The bot checks that the message contains English words, is not too long, and then concatenates the most recent messages to generate a prompt. The prompt is used to generate a response using the OpenAI GPT-3 API.

I use Google's Text-to-Speech API to generate an audio file of the response, which is then played using VLC. The bot also sends the response to the Twitch chat and logs it to a file.

This code is a fork of Kuebiko. Make sure to check it out!

Video instructions by adi-panda here (original video for Kuebiko but about the same steps)

Getting Started

To get a local copy up and running follow these simple example steps.

Prerequisites

  • VLC must be in installed on your computer!

In order to install the prerequisites you will need to do:

  • pip
    pip install -r requirements.txt

Installation

  1. Install VLC 64-bit from here
  2. Get a OpenAI API Key here
  3. Get a Twitch API Token here
  4. Create a Google Cloud Project with TTS Service enabled and download JSON credentials file.
  5. Clone the repo
    git clone https://github.com/idkanymre/kyumnii.git
  6. Enter your Twitch Username in main.py > initial_channels
    super().__init__(token='cred.twi_token', prefix='?', initial_channels=[''])
  7. Add the Google Cloud JSON file into the project folder.
  8. Add the name of the Google Cloud JSON File into main.py
    os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = ''
  9. Add the OpenAI API and Twitch OAuth token into cred.py
    # get your twitch oauth token here: https://twitchapps.com/tmi/
    twi_token="oauth:xxxxxxxxxxxxxxxxxx"
    
    # get your openai token here: https://beta.openai.com/account/api-keys
    openai_token="sk-xxxxxxxxxxxxxxxxxx"
  10. Download VTube Studio and use VBAudio Cable to route audio coming from the program to Vtube Studio using params.
  11. Add the following script to OBS
  12. Create a new text source for captions, and set it to read from a file, select the output.txt file in \your documents folder\kyumnii (may need to run the script first in order to see it.)
  13. In the script options put the name of your text source.
  14. Set the script in transform options to scale to inner bounds, and adjust the size of the captions.
  15. In order to change the voice of your AI, you will need to change the following parameters in main.py Here is a list of supported voices
      voice = texttospeech.VoiceSelectionParams(
          language_code="en-US",
          name= "en-US-Neural2-H",
          ssml_gender=texttospeech.SsmlVoiceGender.FEMALE,
  )

I made this code public due to discontinuing the "kyumnii" social media and thought to share what I made for others! If you want to continue kyumnii's social media please message me on twitter here for enquiries.

https://twitch.tv/kyumnii https://youtube.com/@kyumnii

made with ๐Ÿ’– by unslyu with idkanymore

kyumnii's People

Contributors

y5ta79 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.