This is a Python-based Streamlit application that allows users to input a query and generate code or responses using Google Generative AI (Gemini).
- Enter a query or code snippet, and the app generates relevant responses.
- Integrates with Google Generative AI to provide AI-generated content.
- The app uses Streamlit for a fast and interactive web interface.
- Supports a chat-like interface where the user and the assistant (AI) exchange messages.
Before running the application, make sure you have the following installed:
- Python 3.x (preferably the latest version)
- Streamlit - A Python framework for building interactive apps.
- Google Generative AI - The Python client for Google's AI models.
You will also need a Google API key to use the generative models.
Clone this repository to your local machine:
git clone <repository_url>
cd <repository_name>It's a good practice to use a virtual environment. Here's how to create and activate one:
python -m venv venv
.\venv\Scripts\activatepython3 -m venv venv
source venv/bin/activateInstall the necessary dependencies by running the following command in your terminal:
pip install -r requirements.txtAlternatively, install each package individually:
pip install streamlit google-generativeai python-dotenv- Create a
.envfile in the root of the project directory. - Add your Gemini API Key to the
.envfile:
gemini_api_key=YOUR_API_KEY_HERE
Replace YOUR_API_KEY_HERE with your actual API key from Google.
Start the Streamlit application by running:
streamlit run app.pyThis will open the app in your default browser. You can now start using the app to input code queries and generate responses.
- Enter a Query: In the input box, type a programming-related question or code snippet. For example: "How do I write a Python function to reverse a string?"
- Generate Response: Click the "Search" button, and the assistant will generate an answer based on the input.
- View Chat History: The assistant's responses will appear in a chat-like interface.
- Clear History: Click the "Clear history" button to reset the conversation.
For example, if you input:
Python code says hello world
The assistant might respond with:
print("Hello, World!")If you want to contribute to this project, feel free to fork it, create a branch, and submit a pull request. All contributions are welcome!
This project is licensed under the MIT License.