Welcome to the world of AI-driven personal assistance! In this article, we’ll guide you through the process of setting up your own AI assistant using the ChatGPT-chan open-source library. This collection of tools allows developers to leverage the power of OpenAI’s ChatGPT language model to create conversational interfaces and automate various tasks in their projects.
Requirements
- Python 3.9
- Docker
Setup Instructions
1) Emotion Classifier (Can be hosted on a different server)
To get started, you’ll first need to set up the Emotion Classifier. This classifier helps the assistant respond in a more emotionally intelligent way.
git clone https://github.com/mmabrouk/chatgpt-wrapper.git
cd chatgpt-wrapper/emotion_detection
docker build -t emotion_detector .
docker run --rm -it --host net --gpus all emotion_detector
2) Stable Diffusion Model (Optional)
If you wish to extend the capabilities of your assistant with image generation, you can set up the Stable Diffusion model. This can be hosted on a separate server as well.
git clone https://github.com/mmabrouk/chatgpt-wrapper.git
cd chatgpt-wrapper/diffusion_model
pip install transformers
# generate a huggingface token
huggingface-cli login
# move that token to diffusion_model
sh build.sh
sh run.sh
In your use case, if you are hosting on Raspberry Pis, the run.sh will start a web server on port 8088. You can send a GET request with a text prompt like:
http://127.0.0.1:8088?prompt=panda eating ice cream
To enhance performance, the images have been cached based on categorized emotions in chatgptpyanime_expressions.
3) ChatGPT Wrapper
The ChatGPT wrapper brings together various functionalities including image slideshows, cached stable diffusion expressions, text-to-speech, and speech-to-text capabilities.
git clone https://github.com/mmabrouk/chatgpt-wrapper.git
cd chatgpt-wrapper
chatgptpy
# Register for Azure Neural TTS API here
# put the keys and region in ~/.bashrc
SPEECH_KEY=aws_speech_key
SPEECH_REGION=azure_regions
source ~/.bashrc
# Fire up the emotion_detection server and the optional stable diffusion server from previous steps
map the IPs in chatgptpy/main.py
EMOTION_DETECTION_IP=http://127.0.0.1:5004
STABLE_DIFFUSION_IP=http://127.0.0.1:8088
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
pip install git+https://github.com/mmabrouk/chatgpt-wrapper
python main.py
Troubleshooting
While setting up your ChatGPT-chan assistant, you may encounter some challenges. Here are some common troubleshooting ideas:
- If the ChatGPT wrapper fails, try switching to a different implementation of the ChatGPT API.
- The Docker implementation with Playwright can sometimes be tricky. Ensure that Docker is properly installed and check your resource allocations.
- Make sure you have the correct permissions to run Docker commands.
For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.
Conclusion
At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.
Understanding the Code: An Analogy
Think of setting up the ChatGPT-chan as if you are building a Lego castle. Each step represents a different set of Lego pieces put together to form different parts of your castle.
- The Emotion Classifier is like building a beautiful door that helps your assistant communicate more gently and understandingly with users.
- The Stable Diffusion model acts as the decoration elements of your castle, adding splashes of color and creativity with image generation.
- The ChatGPT wrapper is the structure that holds everything together, ensuring stability and functionality, making your assistant interactive and engaging.
Just like Lego, assembling these components can be challenging. However, with patience and following our guide, you’ll have your very own AI assistant up and running effectively! Enjoy the process and happy coding!

