A multilingual conversational AI assistant that helps users understand loan eligibility, guides them through the loan application process, and provides basic financial literacy tips.
- Loan Eligibility Check: Ask a few questions, understand the user's financial situation, and provide an eligibility check for different types of loans.
- Loan Application Guidance: Guide users through the steps to apply for a loan, helping them with required documents and information.
- Financial Literacy Tips: Offer simple, easy-to-understand financial tips, such as saving strategies or tips on improving credit scores.
- Multilingual Support: Interact with users in multiple Indian languages.
- Voice & Text Input: Support for both voice and text-based interactions.
- 30-Second Audio Limit: Audio processing is limited to 30 seconds to ensure efficient processing.
- Language-Preserving Responses: Responses are delivered in the same language as the input.
- Exclusive Sarvam AI Translation: Uses only Sarvam AI for all translation needs, ensuring high-quality, consistent translations.
- Clone this repository
- Install the required packages:
pip install -r requirements.txt - Create a
.envfile with your API keys:SARVAM_API_KEY=your_sarvam_api_key GEMINI_API_KEY=your_gemini_api_key # Only needed for the Gemini fallback example - Run the application:
streamlit run app.py
- Select your preferred language from the dropdown menu.
- Choose between voice or text input.
- If using voice, click the "Record" button and speak your query.
- If using text, type your query in the text box and press Enter.
- The assistant will respond in the same language you used for your input, regardless of the language selected in the sidebar.
The system now uses a two-step approach for handling multilingual responses:
- Translation: First, the English response is translated to the detected input language.
- Transliteration: Then, the translated text is transliterated to ensure it uses the correct script for the language.
This ensures that responses are not only in the same language as the input, but also use the appropriate script and formatting.
For a Kannada input like:
ನನಗೆ 32 ವರ್ಷ ವಯಸ್ಸು, ತಿಂಗಳಿಗೆ 45,000 ರೂಪಾಯಿ ಸಂಬಳ ಇದೆ, ಮತ್ತು 750 ಕ್ರೆಡಿಟ್ ಸ್ಕೋರ್ ಇದೆ.. ನಾನು ಗೃಹ ಸಾಲದ ಅರ್ಹತೆ ಹೊಂದಿದ್ದೇನೆಯೇ? ನಾನು ಕಳೆದ ಐದು ವರ್ಷಗಳಿಂದ ವೇತನಭೋಗಿ ಉದ್ಯೋಗಿಯಾಗಿದ್ದೇನೆ.
The system will:
- Detect the language as Kannada
- Translate it to English for processing
- Generate a response in English
- Translate the response back to Kannada
- Transliterate the translated text to ensure proper Kannada script
Available modes:
- translate: Translate text
- transliterate: Transliterate text
- stt: Speech-to-Text conversion (requires --audio-file)
- tts: Text-to-Speech conversion
- record: Record audio and convert to text
- all: Run all demo functions
- English (en-IN)
- Hindi (hi-IN)
- Tamil (ta-IN)
- Telugu (te-IN)
- Bengali (bn-IN)
- Kannada (kn-IN)
- Malayalam (ml-IN)
- Punjabi (pa-IN)
- Marathi (mr-IN)
- Gujarati (gu-IN)
The application uses the Sarvam AI API for the following functions:
- Text Translation: Translate text between languages
- Text Transliteration: Transliterate text between scripts
- Speech-to-Text: Convert audio to text
- Speech-to-Text Translation: Convert audio to text and translate
- Text-to-Speech: Convert text to audio
All API interactions are implemented using the requests library with support for multipart form data where needed. The application relies exclusively on Sarvam AI for all translation needs, with no fallback to third-party translation services.
- Frontend: Streamlit
- Language Processing: Sarvam AI API (via requests)
- LLM Provider: GORQ
- Data Storage: Local JSON
- Audio Processing: pydub, sounddevice