A comprehensive collection of Google Gemini AI-powered applications built with Streamlit, featuring multiple interaction modes including text chat, Q&A, and image analysis capabilities.
- Text Chat: Interactive conversational AI with chat history
- Q&A Mode: Simple question and answer interface
- Image Analysis: Upload and analyze images with AI
- Streaming Responses: Real-time response streaming for better user experience
- Session Management: Persistent chat history across interactions
- Modern UI: Clean and responsive Streamlit interface
streamlit-gemini-apps/
βββ app.py # Basic Q&A application
βββ chat.py # Streaming chat with history
βββ gpt.py # Enhanced chat interface with styling
βββ qachat.py # Q&A with chat history
βββ vision.py # Image analysis application
βββ requirements.txt # Project dependencies
βββ env.example # Environment variables template
βββ Dockerfile # Docker configuration
βββ docker-compose.yml # Docker Compose setup
βββ README.md # Project documentation
-
Clone the repository
git clone https://github.com/yourusername/streamlit-gemini-apps.git cd streamlit-gemini-apps -
Install dependencies
pip install -r requirements.txt
-
Set up environment variables
- Copy the example environment file:
cp env.example .env
- Edit the
.envfile and add your Google API key:
GOOGLE_API_KEY=your_api_key_here -
Get Google API Key
- Visit Google AI Studio
- Create a new API key
- Copy the key to your
.envfile
streamlit run app.pystreamlit run chat.pystreamlit run gpt.pystreamlit run qachat.pystreamlit run vision.py-
Set up environment variables
cp env.example .env # Edit .env file with your Google API key -
Run with Docker Compose
# Run the enhanced chat interface (default) docker-compose up # Run a specific application docker-compose -f docker-compose.yml run --rm app streamlit run app.py docker-compose -f docker-compose.yml run --rm chat streamlit run chat.py docker-compose -f docker-compose.yml run --rm gpt streamlit run gpt.py docker-compose -f docker-compose.yml run --rm qachat streamlit run qachat.py docker-compose -f docker-compose.yml run --rm vision streamlit run vision.py
-
Access the application
- Open your browser and go to
http://localhost:8501
- Open your browser and go to
-
Build the Docker image
docker build -t streamlit-gemini-apps . -
Run the container
# Run with environment variables docker run -p 8501:8501 --env-file .env streamlit-gemini-apps # Run a specific application docker run -p 8501:8501 --env-file .env streamlit-gemini-apps streamlit run gpt.py
# Build the image
docker build -t streamlit-gemini-apps .
# Run the default application (gpt.py)
docker run -p 8501:8501 --env-file .env streamlit-gemini-apps
# Run specific applications
docker run -p 8501:8501 --env-file .env streamlit-gemini-apps streamlit run app.py
docker run -p 8501:8501 --env-file .env streamlit-gemini-apps streamlit run chat.py
docker run -p 8501:8501 --env-file .env streamlit-gemini-apps streamlit run qachat.py
docker run -p 8501:8501 --env-file .env streamlit-gemini-apps streamlit run vision.py
# Run in background
docker run -d -p 8501:8501 --env-file .env --name gemini-app streamlit-gemini-apps
# Stop the container
docker stop gemini-app
# Remove the container
docker rm gemini-appFor development with hot reload:
# Run in development mode with file watching
docker-compose -f docker-compose.yml -f docker-compose.dev.yml up
# Run specific application in development mode
docker-compose -f docker-compose.yml -f docker-compose.dev.yml up appThe docker-compose.yml includes multiple services for different applications:
| Service | Port | Application | Description |
|---|---|---|---|
app |
8501 | gpt.py | Enhanced chat interface (default) |
qa |
8502 | app.py | Basic Q&A application |
chat |
8503 | chat.py | Streaming chat with history |
qachat |
8504 | qachat.py | Q&A with chat history |
vision |
8505 | vision.py | Image analysis application |
# 1. Clone and setup
git clone https://github.com/yourusername/streamlit-gemini-apps.git
cd streamlit-gemini-apps
# 2. Setup environment
cp env.example .env
# Edit .env with your Google API key
# 3. Run with Docker Compose
docker-compose up
# 4. Access the application
# Open http://localhost:8501 in your browser| File | Description | Features |
|---|---|---|
app.py |
Basic Q&A | Simple question-answer interface |
chat.py |
Streaming Chat | Real-time streaming responses |
gpt.py |
Enhanced Chat | Styled interface with chat history |
qachat.py |
Q&A with History | Question-answer with conversation memory |
vision.py |
Image Analysis | Upload and analyze images with AI |
GOOGLE_API_KEY: Your Google Gemini API key (required)
- Default model:
gemini-pro - Vision model:
gemini-pro-vision - Streaming: Enabled for real-time responses
streamlit- Web application frameworkgoogle-generativeai- Google Gemini AI SDKpython-dotenv- Environment variable managementPIL(Pillow) - Image processing for vision features
- Customer Support: Automated Q&A systems
- Content Analysis: Image and text analysis
- Educational Tools: Interactive learning assistants
- Research: AI-powered research assistance
- Prototyping: Rapid AI application development
- Never commit your
.envfile to version control - Keep your API keys secure and private
- Consider using environment variables in production
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Google for the Gemini AI API
- Streamlit team for the amazing framework
- Open source community for inspiration
If you encounter any issues or have questions:
- Check the Issues page
- Create a new issue with detailed description
- Contact the maintainers
Made with β€οΈ using Streamlit and Google Gemini AI