This is a robust application that leverages OpenAI's powerful models for processing images and audio, and generating responses via a chat interface. This project is designed to be modular, production-friendly, and deployable using Docker.
- Features
- Installation
- Usage
- Configuration
- Project Structure
- Logging
- Docker Deployment
- Contributing
- License
- Image Processing: Converts images to base64 and uses them as inputs for generating responses.
- Audio Processing: Transcribes audio files using OpenAI's Whisper model.
- Chat Interface: Interactive chat interface built with Chainlit.
- Modular Design: Easy to maintain and extend.
- Production Ready: Includes logging, error handling, and Docker deployment.
- Python 3.9+
- Docker (for deployment)
-
Clone the repository:
git clone https://github.com/your-username/my_project.git cd my_project
-
Create a virtual environment and activate it:
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install the dependencies:
pip install -r requirements.txt
-
Set your OpenAI API Key:
export OPENAI_API_KEY='your_openai_api_key' # On Windows use `set OPENAI_API_KEY=your_openai_api_key`
-
Run the application:
python app/main.py
-
Interacting with the Chat Interface:
- Upload images or audio files.
- Type your query and get responses generated by OpenAI's models.
The configuration settings for this project are managed using a dataclass
in the config.py
file.
The project is structured as follows:
app/
: Contains the main application code.__init__.py
main.py
: Contains the main application logic.api.py
: Handles interactions with the OpenAI API.utils.py
: Includes utility functions.config.py
: Manages configuration settings.logger.py
: Configures logging settings.
Dockerfile
: Defines the Docker image configuration.requirements.txt
: Lists the Python dependencies.template.py
: Script to create the project structure.
Logging is configured using the logger.py
module. Logs are written to the console with an INFO level.
To deploy the application using Docker, use the following steps:
docker build -t my_project .
docker run -p 8000:8000 my_project
Contributions are welcome! Please fork the repository and create a pull request with your changes.
This project is licensed under the MIT License - see the LICENSE file for details.