A completely free, open-source Swedish voice chatbot using Whisper, Swedish language models, and text-to-speech.
- 🎤 Swedish Speech Recognition - Whisper with Swedish optimization
- 🧠 Swedish AI Responses - Bellman model for natural conversation
- 🔊 Swedish Text-to-Speech - Google TTS
- 💬 Natural Conversation - Optimized for back-and-forth chat
- 🌐 Web Interface - Easy-to-use Gradio interface
- 🔒 Completely Free - No API keys required for basic functionality
git clone <your-repo-url>
cd swedish-chatbot
# Automatic setup (recommended)
./setup_environment.sh
# Or manual setup:
python3 -m venv chatbot_env
source chatbot_env/bin/activate
pip install -r requirements.txt
For best Swedish models, get a free token from Hugging Face:
export HF_TOKEN='your_token_here'
# Easy way:
./start_fixed_chatbot.sh
# Or manual:
source chatbot_env/bin/activate
export HF_TOKEN='your_token_here' # Optional
python swedish_chatbot_fixed.py
- Open http://localhost:7861 in your browser
- Click the microphone and speak Swedish
- Listen to the AI's Swedish response
- Continue the conversation naturally!
brew install [email protected] portaudio ffmpeg
sudo apt install python3-venv python3-pip portaudio19-dev ffmpeg mpg123 alsa-utils
- Install Python 3.11+
- Install ffmpeg
- The setup script will handle the rest
Try these Swedish phrases to test the chatbot:
- "Hej, vad heter du?"
- "Hur mår du idag?"
- "Berätta om Sverige"
- "Vad gillar du?"
- "Kan du hjälpa mig?"
swedish-chatbot/
├── swedish_chatbot_fixed.py # Main chatbot (recommended)
├── swedish_chatbot_whisper.py # Alternative version
├── requirements.txt # Python dependencies
├── setup_environment.sh # Environment setup script
├── start_fixed_chatbot.sh # Quick start script
├── setup_token.py # HF token setup helper
├── .gitignore # Excludes virtual env and models
├── README.md # This file
├── FIXED_VERSION_GUIDE.md # Detailed fix explanations
└── docs/ # Additional documentation
├── MODEL_SETUP.md
├── QUICKSTART.md
└── FIXES_SUMMARY.md
- The
chatbot_env/
folder is NOT included in git (it's in.gitignore
) - Never commit the virtual environment - it's huge (several GB)
- Each user creates their own environment using
setup_environment.sh
- Models are downloaded automatically on first run
- Models are cached locally (~2-7GB depending on which models load)
- Model cache is NOT committed to the repository
- Only
requirements.txt
is committed - lists what to install - Virtual environment is created fresh for each installation
- This keeps the repository small and portable
- Grant microphone permissions in System Preferences
- Allow your browser to access microphone
# Clear cache and retry
rm -rf ~/.cache/huggingface/
python setup_token.py # Set up HF token
python swedish_chatbot_fixed.py
# Install audio dependencies
brew install portaudio ffmpeg # macOS
sudo apt install portaudio19-dev ffmpeg # Linux
- Uses OpenAI Whisper "small" model
- Optimized Swedish language settings
- Better accuracy than basic Whisper
- Bellman (
neph1/bellman-7b-mistral-instruct-v0.2
) - Best Swedish conversation - GPT-SW3 (
AI-Sweden-Models/gpt-sw3-126m
) - Official Swedish model (requires HF token) - DialoGPT (
microsoft/DialoGPT-small
) - Good fallback - DistilGPT2 - Basic fallback
- Short, natural responses (40 tokens max)
- Artifact filtering (removes "Datum:", "Kubernetes", etc.)
- Model-specific prompt optimization
- Context-aware conversation
- Fork the repository
- Create your feature branch
- DON'T commit the virtual environment (it's already in
.gitignore
) - Only commit code, documentation, and requirements
- Submit a pull request
MIT License - feel free to use for personal or commercial projects.
- OpenAI Whisper for speech recognition
- AI Sweden for GPT-SW3 models
- Bellman project for excellent Swedish conversation AI
- Gradio for the web interface
- Google for Text-to-Speech