A full-stack AI application that generates descriptive captions for images.
Built with FastAPI (Backend), Streamlit (Frontend), and Docker.
- AI Image Captioning: Uses the
Salesforce/blip-image-captioning-basemodel to analyze images. - Microservices Architecture: Backend and Frontend are decoupled.
- Containerized: Fully wrapped in Docker for easy deployment.
- Model: Hugging Face Transformers (BLIP)
- Backend: FastAPI, Uvicorn
- Frontend: Streamlit
- Deployment: Docker & Docker Compose
The easiest way to run this app is using Docker.
- Clone the repository:
git clone https://github.com/Ankit-Navrang-Meshram/image-caption-app.git cd image-caption-app
2. **Run with Docker Compose:**
```bash
docker-compose up --build
- Open the App:
- Frontend: http://localhost:8501
- Backend Docs: http://localhost:8000/docs
If you prefer running it manually, you need two terminal windows.
1. Setup Environment
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate pip install -r requirements.txt
2. Start Backend (Terminal 1)
uvicorn app.main:app --reload --port 8000
3. Start Frontend (Terminal 2)
Note: You may need to update API_URL in frontend/ui.py to http://127.0.0.1:8000/predict if it's set to the Docker hostname.
streamlit run frontend/ui.py
āāā app/
ā āāā main.py # FastAPI endpoints
ā āāā model.py # AI Model logic
āāā frontend/
ā āāā ui.py # Streamlit Interface
āāā Dockerfile # Docker instructions
āāā docker-compose.yml # Orchestration
āāā requirements.txt # Dependencies
āāā README.md
'''