🎃 RedditAI is a Flask web app that leverages Google Gemini and the Reddit API to fetch Reddit post comments and generate AI-powered summaries or insights. It is designed for easy exploration and summarization of Reddit discussions.
- 🔍 Fetches Reddit post comments using the Reddit API (via PRAW).
- 🤖 Summarizes or analyzes Reddit threads using Google Gemini (via agno).
- 🖥️ Simple, interactive web interface built with Flask.
- 🛠️ Modular design for easy extension and debugging.
- User Input: Enter a Reddit post URL in the app.
- Fetching Comments: The app retrieves all comments for the post using the Reddit API.
- AI Summarization: Comments are passed to a Gemini-powered agent, which generates a summary or insight.
- Display: The result is shown in markdown format in the app.
git clone https://github.com/TheCarBun/RedditAI.git
cd reddit-aipip install -r requirements.txtDependencies include:
flaskprawagnogoogle-genaipython-dotenvmarkdown
Create a .env file in the project root with your API keys:
CLIENT_ID=your_reddit_client_id
CLIENT_SECRET=your_reddit_client_secret
USER_AGENT=your_reddit_user_agent
GEMINI_API_KEY=your_gemini_api_keyYou can obtain Reddit API credentials from Reddit Apps and Gemini API keys from Google.
python app.pyThe app will start on http://localhost:5000.
- Open the app in your browser at
http://localhost:5000. - Paste a Reddit post URL (e.g.,
https://www.reddit.com/r/Python/comments/xxxxxx/...). - Click Summarize.
- View the AI-generated summary or analysis.
reddit-ai/
├── app.py # Flask app entry point
├── reddit_ai.py # Reddit API utilities and AI integration
├── instructions.py # (Custom instructions for the agent)
├── requirements.txt
├── templates/
│ ├── index.html
│ └── summary.html
└── README.md
- Handles Reddit API authentication and data fetching.
get_post_comments: Fetches all comments for a given post.get_post_details: Fetches post metadata.run_reddit_ai: Runs the Gemini-powered agent.
- Sets up the Flask UI and routes.
- Handles user input and displays results.
- Integrates with the Reddit and Gemini agent utilities.
- Instructions: Modify
instructions.pyto change how the agent summarizes or analyzes posts. - Tools: Add more tools to the agent for extended functionality.
- The app runs in read-only mode for Reddit.
- Ensure your API keys are kept secret and not committed to version control.
MIT License. See LICENSE for details.
Enjoy exploring Reddit with AI!