Spaces:
Running
Running
A newer version of the Gradio SDK is available:
5.41.1
metadata
title: Mbti Pocketflow
emoji: π₯
colorFrom: pink
colorTo: gray
sdk: gradio
sdk_version: 5.38.2
app_file: app.py
pinned: false
short_description: PocketFlow application for conducting Myers-Briggs + llm
MBTI Personality Questionnaire
A PocketFlow-based application for conducting Myers-Briggs Type Indicator (MBTI) personality assessments with both traditional scoring and AI analysis.
Features
- 20/40/60-question MBTI questionnaire with selectable length for accuracy
- Traditional scoring algorithm for baseline personality type determination
- AI-powered analysis using LLM for detailed personality insights with question references
- Interactive Gradio web interface with auto-save and progress tracking
- HTML report generation with clickable question references and comprehensive analysis
- Data export/import for saving and resuming questionnaires
- CLI and test modes for different use cases
Project Structure
/mbt/
βββ utils/
β βββ call_llm.py # LLM integration (Gemini)
β βββ questionnaire.py # Question sets (20/40/60) and loading/saving
β βββ mbti_scoring.py # Traditional MBTI scoring
β βββ report_generator.py # HTML report generation with markdown support
β βββ test_data.py # Test data generation
βββ nodes.py # PocketFlow nodes (LoadQuestionnaire, LLMAnalysis, etc.)
βββ flow.py # PocketFlow flow definition
βββ app.py # **Main Gradio web interface with LLM**
βββ pf_cli.py # PocketFlow CLI interface
βββ requirements.txt # Dependencies
Quick Start
1. Web Interface (Recommended)
# Install dependencies
pip install -r requirements.txt
# Set up Gemini API key
export GEMINI_API_KEY="your-api-key-here"
# Or on Windows:
set GEMINI_API_KEY=your-api-key-here
# Run Gradio web interface
python app.py
Then open http://127.0.0.1:7860 in your browser.
2. Command Line Interface
# Run CLI questionnaire
python pf_cli.py
# Run with test data
python pf_cli.py --test --test-type INTJ
# Import previous questionnaire
python pf_cli.py --import-file questionnaire.json
Usage Examples
Gradio Web Interface
python app.py
- Interactive web interface at http://127.0.0.1:7860
- Question length selection (20/40/60 questions)
- Auto-save responses as you navigate
- Progress tracking and export functionality
- AI analysis with clickable question references
- HTML report generation with comprehensive insights
- Load/save questionnaires for resuming later
Command Line Interface
python pf_cli.py
- Complete PocketFlow architecture
- Traditional scoring with optional LLM analysis
- Automatic report generation
- Data import/export in JSON format
Test Modes
# CLI test with specific MBTI type
python pf_cli.py --test --test-type ENFP
Import/Export
# Export: Questionnaire data automatically saved as:
# mbti_questionnaire_pf_partial_[COUNT]q_[TIMESTAMP].json
# Import: Load previous questionnaire
python pf_cli.py --import-file questionnaire.json
MBTI Types Supported
The application recognizes all 16 MBTI personality types:
Analysts: INTJ, INTP, ENTJ, ENTP
Diplomats: INFJ, INFP, ENFJ, ENFP
Sentinels: ISTJ, ISFJ, ESTJ, ESFJ
Explorers: ISTP, ISFP, ESTP, ESFP
Key Features
Question Sets
- 20 questions: Quick assessment (5 per dimension)
- 40 questions: Balanced assessment (10 per dimension)
- 60 questions: Comprehensive assessment (15 per dimension)
AI Analysis
- Question-specific insights with clickable references like Q1
- Out-of-character response detection and explanations
- Evidence-based analysis citing specific question responses
- Behavioral pattern identification
- Strengths and growth areas based on actual responses
Web Interface Features
- Auto-save responses on navigation
- Progress tracking with completion indicators
- Export progress at any time (partial questionnaires)
- Load previous sessions to continue where you left off
- Immediate download of reports and data
Development
Adding New Features
- Implement utility functions in
utils/
- Create or modify nodes in
nodes.py
- Update flow in
flow.py
- Test with CLI and web interface
Dependencies
Required:
- Python 3.8+
- gradio>=4.0.0 (web interface)
- google-genai>=0.3.0 (LLM analysis)
- beautifulsoup4 (HTML parsing)
- markdown (report generation)
Optional:
- pydantic (enhanced data validation)
See requirements.txt
for complete list.
File Overview
gradio_pf_llm.py
- Main web interface with full LLM analysispf_cli.py
- Command line interface using PocketFlow architecturenodes.py
- PocketFlow node implementationsflow.py
- PocketFlow pipeline definitionutils/
- Core utility functions (questionnaire, scoring, reports, LLM)
License
This project follows PocketFlow's open-source approach for educational and research purposes.