by Ryan Majd
The imgToICS
application is designed to convert images/flyers containing event details into ICS (iCalendar) files. It is programmed in Python and available in two formats: a graphical user interface (GUI) and a command line interface (CLI).
This is my first python application that I am releasing to the public, so please go easy on me 😸!
- Python 3.6 or higher
- Python libraries installable using
install_py_pkgs.sh
- Internet connection for API requests
- OpenAI API Key
PySimpleGUI
forimgToICS_GUI.py
file onlyos
for outputting the ics filerequests
for HTTP requestsdatetime
for handling datesdotenv
for loading environment variables (.env
)
- Install the required Python packages:
pip install PySimpleGUI requests python-dotenv
- Ensure you have an API key from OpenAI for GPT-4 model access and you provided a minimum of $5 to utilize their multimodal LLMS (such as gpt-4o).
- CLI USERS ONLY: Create a
.env
file in the application directory and store your OpenAI API key:OPENAI_API_KEY='apikey'
The GUI version provides a user-friendly interface for generating ICS files:
- Run the script:
python3 imgToICS_GUI.py
- Fill in the fields for the image path, API key, and output directory (some may be preloaded).
- Click 'Generate ICS' to process the image and generate the ICS file!
The CLI version is streamlined for command line usage:
- Usage:
python3 imgToICS_CLI.py <input_file> <output_location>
- Provide the path to the image file and the desired output directory as command line arguments.
Both versions of the application will:
- Encode the provided image to base64.
- Send a request to OpenAI's API using the encoded image.
- Parse the response to create an ICS file containing the event details.
- Save the ICS file in the specified output directory.
- API keys are not stored or logged by the application through the code, ensuring your credentials remain secure. (Now utilizing PySimpleGUI 5's parameter element)
- Always verify outputs for accuracy and completeness.
- This project is open-sourced 😺