This app creates text captions for food images which can be used for maintaining social media of a restaurant.
A user can pass up to 9 photos as input which are then categorised into one or several food classes. After that, the information is formatted and passed to an OpenAI model which generates a corresponding text caption.
- Clone the repository:
git clone https://github.com/slavafive/Food-Text-Generator.git app
cd app
- Install yarn and run the frontend application:
yarn install
yarn start
This will start the frontend application at http://localhost:3000.
- Set the OpenAI API config key in api/config/config.yaml file
open_ai_key: "YOUR_API_KEY"
Note. You can view your OpenAI API keys by logging in at openai.com, then choosing API in the central menu, then clicking the avatar on top right corner and choosing the option "View API keys".
- Navigate to
api
directory and create a virtual environment there:
cd api
python3 -m venv venv
source venv/bin/activate
Make sure to use the version of Python greater than 3.9.0.
- Install the required dependencies:
pip3 install -r requirements.txt
- Launch the backend application (from the
api
directory):
sudo flask run
- Now you can go to http://localhost:3000. in your web browser and generate text captions!
The application accepts unly URLs of photos. That is said, if you would to process a certain type of image, type its name in the browser, make a right click on it and choose the option "Copy Image Address".*
Then insert the copied URL into the application input field.
After inserting the desired URLs, click the "Generate" button. This will classify each image into one of available food classes and create an image caption describing the group of photos.
Note. Expect to wait up to 10 seconds for a single image to be processed.
- Frontend: HTML, CSS, JavaScript, React.js
- Backend: Python, Flask
- Machine Learning: langchain, transformers, nltk
- Python: 3.10.2