Hey everyone! 👋
It's me, Gc, 🎉
I'm excited to share a new project I've been working on: an image editing and event description rephrasing web app using Flask. 🎨 This handy tool lets you upload images, add event names directly on the images, and rephrase event descriptions for better grammar and readability, all in one place! 📸
Here's how it works:
- Upload Your Images: Easily upload multiple images. 🖼️
- Event Names: Type in your event names, which will be neatly placed at the top-middle of each image. ✍️
- Description Rephrasing: Enter event descriptions, and watch as they get magically rephrased using Google Gemini, providing you with polished and grammatically correct content. 🔄
- Download as
.docx
: Finally, download a.docx
file that includes all your edited images and rephrased descriptions, ready to be shared or printed. 📥
By default, the tool is set up to process images and descriptions for quick and easy use. But don't worry, it's fully customizable! You can adjust the font, text position, or even the integration settings with a bit of code tweaking. 🛠️
If you encounter any bugs 🐞 or need help, feel free to reach out. I'm here to assist and make your experience as smooth as possible. So go ahead, upload some images, add your events, and get those descriptions rephrased! 🎉
This project is a Flask-based web application that allows users to upload images, input event names and descriptions, and receive a .docx
file containing edited images and rephrased event descriptions. The edited images display the event names at the top, and the descriptions are rephrased using the Google Gemini text generation model.
- Image Upload: Users can upload multiple images. 📸
- Event Name: Each image can have an event name placed at the top-middle. ✍️
- Description Rephrasing: Event descriptions are rephrased using Google Gemini for grammatical improvements. 🔄
- Output as
.docx
: Generates a.docx
file containing the edited images and rephrased descriptions. 📥
- Python 3.x
- pip
git clone https://github.com/yourusername/image-editor-rephrasing.git
cd image-editor-rephrasing
pip install -r requirements.txt
Ensure your requirements.txt
includes:
flask
pillow
requests
python-docx
google-generativeai
-
Run the Flask Application:
python app.py
-
Open your Web Browser:
Visit
http://127.0.0.1:5000/
to access the application. -
Upload Images and Input Event Details:
- Upload one or more images. 🖼️
- Enter event names and descriptions. ✍️
- Click the "Submit" button to generate and download the
.docx
file. 📥
Update the FONT_PATH
in app.py
to point to a valid font file on your system. Example paths:
- Linux:
/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf
- Windows:
C:\Windows\Fonts\Arial.ttf
- macOS:
/Library/Fonts/Arial.ttf
To get an API key for using the Gen AI API for text generation, follow these steps:
If you haven't already, you'll need to create an account on the Gen AI platform:
- Visit the Gen AI website.
- Click on "Sign Up" or "Get Started" to create your account.
- Fill in the required information to register.
Once you have created your account, log in using your credentials:
- Go to the Gen AI login page.
- Enter your email address and password to log in.
After logging in, navigate to the API access section to generate your API key:
- Look for a section or tab labeled "API Access," "Developer," or "API Keys." This is typically found in your account settings or dashboard.
- Click on the section related to API access.
Follow the steps to generate your API key:
- If available, click on a button like "Generate API Key" or "Create New API Key."
- Some platforms might require you to provide a name or description for the API key to help identify its usage.
Once the API key is generated, copy it to your clipboard:
- The API key is usually displayed in a text box or a pop-up window after generation.
- Make sure to copy the entire API key. It is typically a long alphanumeric string.
Ensure you have access to the Google Gemini text generation model or equivalent. Modify the rephrase_content
function in app.py
to integrate with the API, including any required authentication or API keys.
def rephrase_content(description):
model = genai.GenerativeModel('gemini-pro')
response = model.generate_content(description)
return response.text
- Flask: Web framework for the application.
- Pillow: Image processing library.
- Requests: Library to handle HTTP requests.
- python-docx: Library to create and manipulate
.docx
files.
- Fork the repository.
- Create your feature branch (
git checkout -b feature/new-feature
). - Commit your changes (
git commit -m 'Add new feature'
). - Push to the branch (
git push origin feature/new-feature
). - Open a pull request.
- Adjust the Demo GIF link if you have a demo file or screenshots to showcase.
- Update the Clone the Repository link with your actual GitHub repository URL.
- Make sure to modify the
rephrase_content
function based on the actual integration you have with Google Gemini.
Happy coding and enjoy the process! 🎨📸
Cheers,
Gc