Kiyo is a multilingual, voice-enabled chatbot built with Streamlit that uses a locally hosted Large Language Model (LLM) via Ollama. It's designed to break down language barriers and promote inclusive communication, aligning with UN Sustainable Development Goal 10 (Reduced Inequalities).
This application features real-time language translation, speech-to-text, and text-to-speech capabilities, allowing users to interact with an AI in their native language effortlessly.
- Multilingual Conversation: Automatically detects the user's language, translates the input to English for the LLM, and translates the response back to the user's language using Google Cloud Translate.
- Local AI Integration: Leverages Ollama to run a powerful local model like Llama 3, ensuring privacy and fast responses without a cloud dependency for the core AI logic.
- Voice Interface:
- Speech-to-Text: Transcribes spoken user input to text using
SpeechRecognition. - Text-to-Speech: Converts the chatbot's text responses into speech using
pyttsx3.
- Speech-to-Text: Transcribes spoken user input to text using
- User Customization:
- Dialect & Personality: Allows users to choose the bot's conversational style (e.g., Formal, Informal) and personality type.
- Dyslexia-Friendly Mode: Toggles a dyslexia-friendly font (
Lexend) for improved readability.
- Location-Based Suggestions: Provides language suggestions based on the user's geographical location (currently implemented for Indian states).
- RLHF (Reinforcement Learning from Human Feedback) Proxy: Presents the user with two candidate responses and allows them to select their preferred one, which can be used to improve the model's performance.
To run this application, you need to have the following installed:
- Python 3.8+
- Ollama: A local LLM server.
- A Google Cloud Account with the Cloud Translation API enabled.
git clone <repository_url>
cd <repository_name>It's highly recommended to use a virtual environment.
python -m venv venv
source venv/bin/activate ย # On Windows: `venv\Scripts\activate`
pip install -r requirements.txtrequirements.txt content:
streamlit
ollama
google-cloud-translate
SpeechRecognition
pyttsx3
The code requires a Google Cloud service account key for the Translation API.
-
Create a service account and download the JSON key file.
-
Set the
GOOGLE_APPLICATION_CREDENTIALSenvironment variable to the path of your JSON file.
Make sure the Ollama server is running in the background. If you haven't already, pull the Llama 3 model.
ollama run llama3Execute the Streamlit app from your terminal.
streamlit run app.pyReplace app.py with the name of your main Python file if it's different. Your web browser will automatically open the application.
- Chat with Kiyo: Type your message in the text box at the bottom and press Enter. The chatbot will automatically detect your language and respond accordingly.
- Voice Interaction: Click the microphone icon
๐๏ธto reveal voice commands.๐ฃ๏ธ Speak to Chatbot: Use your microphone to give a voice command.๐ Repeat Last Response: Repeats the last response spoken by the chatbot.โน๏ธ Stop: Halts any ongoing speech output.
- Provide Feedback: After the chatbot provides two responses, select the one you prefer by clicking "I Prefer This".
- Customize: Use the sidebar (
โ๏ธ Settings) to adjust the bot's dialect, personality, and font settings.
Contributions are welcome! If you find a bug or have a suggestion for a new feature, please open an issue or submit a pull request.