PostGenius is an AI-powered application that leverages Retrieval-Augmented Generation (RAG) techniques to produce multimedia content such as text posts, images, memes, and videos based on news articles. It is designed for applications like social media management, marketing campaigns, and content creation. The project integrates various APIs, including Groq, Vectara, OpenAI, RunwayML, and NewsAPI, to deliver an efficient and seamless experience.
Prompt: "AI trends"
Tone: Humorous
Platform: Twitter
- Operating System: macOS/Linux/Windows
- Python: Version 3.9 or higher
- Node.js: Version 18 or higher
- Package Management:
pip
,npm
, andvirtualenv
for Python environments
-
Clone the repository:
git clone https://github.com/<your-username>/postgenius.git cd postgenius
-
Set up a Python virtual environment:
python3 -m venv venv source venv/bin/activate # On Windows, use `venv\Scripts\activate`
-
Install Python dependencies:
pip install -r backend/requirements.txt
-
Install JavaScript dependencies for the frontend:
cd frontend npm install cd ..
-
Configure required API keys:
- Create a
.env
file in thebackend/
directory and add the following keys:NEWSAPI_KEY=your_newsapi_key OPENAI_API_KEY=your_openai_key GROQ_API_KEY=your_groq_key VECTARA_CUSTOMER_ID=your_vectara_customer_id VECTARA_API_KEY=your_vectara_api_key RUNWAY_API_KEY=your_runway_api_key IMGFLIP_USERNAME=your_imgflip_username IMGFLIP_PASSWORD=your_imgflip_password
- Create a
Run the backend from the main directory:
cd backend
uvicorn main:app --reload --host 0.0.0.0 --port 8000
Run the frontend from the frontend
directory:
cd frontend
npm run dev
The application will be accessible at:
- Frontend: http://localhost:3000
- Backend: http://localhost:8000
- FastAPI: Framework for building APIs.
- Pydantic: Data validation and parsing.
- Requests: For HTTP requests.
- dotenv: For managing environment variables.
Install all dependencies with:
pip install -r backend/requirements.txt
- Next.js: Framework for building web applications.
- Axios: For API calls.
- Radix UI: Accessible components.
- Tailwind CSS: For styling.
Install all dependencies with:
npm install
- RAM: Minimum 8 GB, 16 GB recommended
- CPU: Quad-core processor or better
- Storage: At least 2 GB of available space
User Input --> Backend API (FastAPI)
--> RAG Retrieval (Groq + Vectara)
--> Content Generation (OpenAI)
--> Multimedia Creation (RunwayML, Imgflip, OpenAI DALL-E)
--> Response (Text, Image, Meme, Video, Sources)
- Frontend: Interface for user input and displaying generated content.
- Backend: Manages retrieval and content generation through various API modules.
- Storage: Indexed data is stored on Vectara for efficient retrieval.
- User Input: The user provides a prompt, tone, and target platform (e.g., Twitter, Instagram).
- Prompt Processing: The backend uses the
groq.py
module to analyze and optimize the prompt. - Retrieval:
- Articles are fetched from NewsAPI and Reddit.
- Vectara indexes and retrieves relevant articles.
- Summary Generation:
- OpenAI GPT generates a summary of the retrieved articles.
- Multimedia Creation:
- Text: Social media posts are generated using OpenAI GPT.
- Images: Illustrations are created using OpenAI DALL-E.
- Memes: Memes are generated via Imgflip with captions from OpenAI GPT.
- Videos: Videos are created using RunwayML.
- Results: The generated content is sent to the frontend and displayed to the user.
- Tone Customization: Adapts content to styles like humorous, formal, or casual.
- Multi-Format Support: Generates text, images, videos, and memes.
- Cited Sources: Provides a list of URLs as sources for the generated content.
# Start the backend
uvicorn main:app --reload
# Start the frontend
cd frontend
npm run dev
# Build and start the frontend
cd frontend
npm run build
npm run start
# Start the backend with Gunicorn
cd backend
gunicorn main:app -k uvicorn.workers.UvicornWorker --bind 0.0.0.0:8000
- View logs for backend and frontend:
tail -f backend.log tail -f frontend.log