A Streamlit application that analyzes Reddit posts on any topic using AI-powered insights. This tool combines Reddit's API with local LLMs through Ollama to provide meaningful analysis of Reddit discussions. It weights the summarization by the Reddit Score value.
- Search and analyze Reddit posts on any topic
- Utilize local LLMs via Ollama for content analysis
- Customize the number of posts to analyze (1-20)
- Generate downloadable markdown reports
- Interactive web interface built with Streamlit
- Python 3.6+
- Streamlit
- PRAW (Python Reddit API Wrapper)
- Ollama
- A Reddit Developer Account
- Clone this repository:
git clone <repository-url>
cd reddit-topic-analysis
- Install the required dependencies:
pip install streamlit praw ollama
- Install Ollama and at least one language model:
# Install Ollama (instructions vary by OS)
curl https://ollama.ai/install.sh | sh
# Pull a model (e.g., Llama 2)
ollama pull llama2
- Set up your Reddit API credentials:
- Go to https://www.reddit.com/prefs/apps
- Create a new application
- Note your client ID and client secret
The application uses the some test Reddit API credentials by default
For security reasons, it's recommended to use environment variables or a configuration file for these credentials in a production environment.
- Start the Ollama service:
ollama serve
- Run the Streamlit application:
streamlit run app.py
-
In the web interface:
- Select your preferred Ollama model from the sidebar
- Adjust the number of posts to analyze using the slider
- Enter a topic in the main area
- Click "Analyze Topic" to generate insights
-
The analysis will include:
- Individual post details (title, subreddit, score)
- AI-generated summary of insights and trends
- Option to download the analysis as a markdown file
The analysis is presented in a structured markdown format:
- Topic header
- List of analyzed posts with links
- Summary of insights and trends
- Download option for the complete analysis
The application includes error handling for:
- Ollama connection issues
- Reddit API errors
- Invalid topic searches
- Model availability checks
- The included Reddit API credentials should be replaced with your own for production use
- Consider implementing proper credential management
- Review Ollama model access and permissions
Feel free to submit issues and enhancement requests!
MIT LICENSE