Skip to content

Amine-LG/Llava-Discord-Bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Llava Discord Bot

This is a Discord chatbot that uses Ollama to leverage the Llava model for generating responses. The Llava model is a multi-modal LLM that can process and understand images, providing detailed descriptions and engaging in meaningful conversations.

Prerequisites

  • A Discord account and a bot token
  • Ollama installed locally from the official website

Setup Instructions

1. Clone the Repository

First, clone the repository to your local machine and navigate to the project directory.

git clone https://github.com/Amine-LG/Llava-Discord-Bot.git
cd Llava-Discord-Bot

2. Create a Virtual Environment

Create a virtual environment to manage dependencies.

python -m venv bot-env

3. Activate the Virtual Environment

Activate the virtual environment.

  • On Windows:
    bot-env\Scripts\activate
  • On macOS/Linux:
    source bot-env/bin/activate

4. Install Dependencies

Install the required packages using requirements.txt.

pip install -r requirements.txt

5. Set Up Environment Variables

Create a .env file in the root directory and add your Discord bot token.

DISCORD_TOKEN=your_discord_bot_token

6. Ensure Ollama is Running Locally

Make sure Ollama is installed and running on your local machine.

7. Install and Run Llava Model

To download and install the Llava model, run the following command in your terminal:

ollama run llava

For more models, visit the Ollama Model Library.

8. Run the Bot

Run the bot using the following command.

python main.py

Code Overview

main.py

This is the main script that runs the bot. It includes the following functionalities:

  • Loading environment variables
  • Initializing logging
  • Defining the bot's behavior
  • Handling messages and attachments
  • Interacting with the Ollama running locally
  • Processing images with the Llava model

Note: The bot keeps track of only the last image sent and processes only one image at a time.

requirements.txt

This file lists all the necessary packages and their versions.

python-dotenv==1.0.1
discord.py==2.3.2
ollama==0.2.0
pillow==10.3.0

Usage

Reset Command

You can reset the conversation log by using the !reset command in Discord.

About

A Discord chatbot to interact with Llava model

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages