Skip to content

aadithya12ctrl/oneiros

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

🌙 Oneiros

AI-Powered Dream Analysis & Temporal Pattern Recognition

A sophisticated dream journal system leveraging Generative AI and Deep Learning to uncover subconscious patterns, emotional arcs, and symbolic meanings in your dreams.

Python Streamlit LangChain Gemini PyTorch Matplotlib


✨ Features

🔮 Advanced Dream Analysis

  • Symbolic Interpretation: Automatically identifies and interprets key symbols using Jungian and modern psychological application.
  • Emotional Decoding: nuanced detection of implicit and explicit emotional states (e.g., nostalgia, dread, lucidity).
  • Psychological Insights: Provides supportive, non-judgmental reflection prompts based on dream content.

🧠 Pattern Recognition Engine

  • Temporal Sequence Analysis: Uses an LSTM (Long Short-Term Memory) neural network to detect patterns across a timeline of dreams.
  • Anomaly Detection: Identifies dreams that deviate significantly from your usual narrative style or emotional baseline.
  • Recurring Theme Tracking: Automatically links new dreams to past entries with similar semantic meaning.

🎨 Relaxing UI/UX

  • Pastel Aesthetic: Designed with calming pink, purple, and blue hues to promote a relaxed state suitable for reflection.
  • Interactive Dashboard: Visualizes emotion frequencies and activity metrics.
  • Emotion Distibution: View your emotional landscape with beautiful pastel pie charts.
  • Semantic Search: "Find dreams about flying" works even if you never used the word "flying" (thanks to vector embeddings).

🤖 AI/ML Technical Deep Dive

1. Vector Embeddings & Semantic Search

Technology: all-MiniLM-L6-v2 (Sentence Transformers)

  • Embeddings: Converts dream narratives into 384-dimensional dense vectors.
  • Vector Store: FAISS (Facebook AI Similarity Search) for millisecond-latency retrieval.
  • Application: Enables the "Recurring Themes" feature, allowing users to find semantically similar dreams (e.g., linking a dream about "drowning" with one about "being overwhelmed at work").

2. Generative Interpretation (LLM)

Technology: Gemini 1.5 Flash (via LangChain)

  • User inputs are processed through specialized prompt templates:
    • DREAM_ANALYSIS_SYSTEM_PROMPT: Enforces the persona of an empathetic expert analyst.
    • SYMBOL_EXTRACTION_TEMPLATE: Structured extraction of archetypes into JSON.
    • EMOTION_EXTRACTION_TEMPLATE: Multi-label emotion tagging.

3. Temporal Pattern Detection

Technology: PyTorch LSTM

  • Architecture: A custom LSTM network taking sequence embeddings as input.
  • Function: Analyzes a sliding window (default size 5) of recent dreams.
  • Outputs:
    • Anomaly Score: Probability of the current sequence being an outlier.
    • Pattern Classification: Detects arcs like anxiety_spike, resolution_arc, or lucidity_increase.

4. Hybrid Analysis Pipeline

The system uses RunnableParallel from LangChain to execute Emotion Extraction and Symbol Recognition concurrently, minimizing latency while maximizing analysis depth.


🏗️ System Architecture

┌─────────────────────────────────────────────────────────────┐
│                      User Dream Entry                       │
└─────────────────────┬───────────────────────────────────────┘
                      │
                      ▼
┌─────────────────────────────────────────────────────────────┐
│                 LLM Analysis (Gemini Flash)                  │
│          • Symbolism   • Emotions   • Psychology            │
└──────────┬──────────────────────────────────────┬───────────┘
           │                                      │
           ▼                                      ▼
┌─────────────────────────────┐    ┌──────────────────────────────┐
│  Vector Store (FAISS)       │    │   Pattern Detector (LSTM)    │
│  • Embeddings (MiniLM)      │    │   • Sliding Window Analysis  │
│  • Semantic Search          │    │   • Anomaly Detection        │
└─────────────────────────────┘    └──────────────────────────────┘
           │                                      │
           └──────────────────┬───────────────────┘
                              │
                              ▼
┌─────────────────────────────────────────────────────────────┐
│                  Oneiros Streamlit Dashboard                 │
│         • Analytics   • Visualizations   • Library          │
└─────────────────────────────────────────────────────────────┘

🚀 Quick Start

Prerequisites

Installation

# Clone the repository (if applicable) or download files
cd oneiros

# Install dependencies
pip install -r requirements.txt

Running the App

Set your API key and run the single-file application.

Windows PowerShell:

$env:GOOGLE_API_KEY = "your-api-key-here"; python -m streamlit run oneiros_app.py

Linux/Mac:

export GOOGLE_API_KEY="your-api-key-here"
streamlit run oneiros_app.py

The app will open at http://localhost:8501


📚 Sample Dreams to Try

  • The Flying Garden: "I was flying over a garden made of crystal. The flowers were singing, but I felt anxious that I would fall."
  • The Lost Key: "I was searching my childhood home for a key I knew I had lost, but every door I opened led to a forest."
  • Late for the Exam: "I ran through endless corridors trying to find my math class, but the numbers on the doors kept changing."

📁 Project Structure

oneiros/
├── oneiros_app.py       # Main application (Consolidated Backend + Frontend)
├── requirements.txt     # Python dependencies
└── README.md            # This documentation

🔒 Context & Disclaimer

Oneiros is a tool for self-reflection and entertainment. It provides AI-generated interpretations based on common psychological symbolism and linguistic patterns. It is not a substitute for professional mental health advice, diagnosis, or treatment. If you are experiencing distress, please consult a qualified professional.


📄 License

MIT License.


Built eeriely using Streamlit, LangChain, and Google Gemini

About

AI-Powered Dream Analysis System

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages