Skip to content

rapidarchitect/reddit_analyzer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

Reddit Topic Analysis Tool

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.

Features

  • 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

Prerequisites

  • Python 3.6+
  • Streamlit
  • PRAW (Python Reddit API Wrapper)
  • Ollama
  • A Reddit Developer Account

Installation

  1. Clone this repository:
git clone <repository-url>
cd reddit-topic-analysis
  1. Install the required dependencies:
pip install streamlit praw ollama
  1. 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
  1. Set up your Reddit API credentials:

Configuration

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.

Usage

  1. Start the Ollama service:
ollama serve
  1. Run the Streamlit application:
streamlit run app.py
  1. 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
  2. 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

Output Format

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

Error Handling

The application includes error handling for:

  • Ollama connection issues
  • Reddit API errors
  • Invalid topic searches
  • Model availability checks

Security Notes

  • 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

Contributing

Feel free to submit issues and enhancement requests!

License

MIT LICENSE

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages