Skip to content

Latest commit

 

History

History
189 lines (123 loc) · 6.27 KB

README.md

File metadata and controls

189 lines (123 loc) · 6.27 KB

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! 🎉


Image Editor and Event Description Rephrasing

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.

Table of Contents

Features

  • 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. 📥

Demo

Demo GIF

Installation

Prerequisites

  • Python 3.x
  • pip

Clone the Repository

git clone https://github.com/yourusername/image-editor-rephrasing.git
cd image-editor-rephrasing

Install Dependencies

pip install -r requirements.txt

requirements.txt

Ensure your requirements.txt includes:

flask
pillow
requests
python-docx
google-generativeai

Usage

  1. Run the Flask Application:

    python app.py
  2. Open your Web Browser:

    Visit http://127.0.0.1:5000/ to access the application.

  3. 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. 📥

Configuration

Font Path

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

Google Gemini API

To get an API key for using the Gen AI API for text generation, follow these steps:

1. Create a Gen AI Account

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.

2. Log In to Your Account

Once you have created your account, log in using your credentials:

3. Navigate to API Access

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.

4. Generate API Key

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.

5. Copy Your API Key

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

Dependencies

  • 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.

Contributing

  1. Fork the repository.
  2. Create your feature branch (git checkout -b feature/new-feature).
  3. Commit your changes (git commit -m 'Add new feature').
  4. Push to the branch (git push origin feature/new-feature).
  5. Open a pull request.

Acknowledgements


Notes

  • 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