This project implements a voice assistant that can process text and audio inputs to provide responses from a generative AI model. Additionally, it can fetch weather updates based on user input. The project uses the following technologies:
- Google Generative AI for generating responses.
- Speech Recognition for converting speech to text.
- pyttsx3 for text-to-speech functionality.
- WeatherAPI for fetching weather information.
- Text Input: Allows users to enter text and receive a generated response.
- Audio Input: Converts spoken words into text and processes it to generate responses.
- Weather Updates: Provides current weather information based on user-specified city.
-
Clone the repository:
git clone https://github.com/yourusername/Voice-Assistant-with-Weather-Updates.git
-
Navigate to the project directory:
cd Voice-Assistant-with-Weather-Updates
-
Install the required packages:
Create a virtual environment (optional but recommended):
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
Install dependencies:
pip install pyttsx3 SpeechRecognition google-generativeai requests
Update the following variables in main.py
:
genai_api_key
: Replace with your API key for Google Generative AI.weather_api_key
: Replace with your API key for WeatherAPI.
-
Run the script:
python main.py
-
Select Input Method:
- Enter
1
to input text manually. - Enter
0
to use audio input.
- Enter
-
Weather Updates:
- If you mention the term "weather" in your input, the program will ask for a city name and fetch the current weather information for that city.
Enter 1 for text input or 0 for audio input: 1
Please enter your text: What is the weather in London?
Weather: The weather in London is currently Clear with a temperature of 15°C.