Skip to content

Hungtangco-stack/hungtang_ai_credibility_analysis_proposal

Repository files navigation

GPT Lie Analysis

An automated AI pipeline for speech-based lie / scam risk analysis, combining Audio preprocessing → Speech-to-text (Whisper) → LLM reasoning → Alerts.

This project is designed for hands-free background monitoring (e.g. mobile call recordings) and supports automatic Gmail / Discord notifications when high-risk speech patterns are detected.


✨ Features

  • 🎧 Audio & video input support (.wav, .mp3, .m4a, .mp4, etc.)
  • 🧠 AI-based lie / scam risk analysis via LLM
  • 📊 Risk scoring with configurable threshold
  • 📬 Automatic Gmail alert
  • 💬 Discord webhook notification
  • 🔁 Folder monitoring (polling-based, stable & mobile-friendly)
  • 🛡 Guardrails to avoid false alerts on very short / insufficient audio
  • 📱 Designed to run persistently on Termux (Android) or Linux

📦 Project Structure

gpt_lie_analysis/
├── src/gpt_lie_analysis/
│   ├── core.py                 # Main pipeline logic
│   ├── whisper_transcribe_api.py
│   ├── gpt_lie_analysis_requests.py
│   ├── audio_loader.py
│   ├── segment_and_analyze.py
│   ├── gmail_notify.py
│   └── cli/
│       └── app.py              # CLI entrypoint
├── scripts/                    # Helper scripts (optional)
├── tests/
├── pyproject.toml
├── requirements.txt
└── README.md

🔧 Requirements

  • Python ≥ 3.10
  • ffmpeg
  • OpenAI API Key

Install system dependency

sudo apt install -y ffmpeg

🔑 Environment Setup

Create a .env file in project root:

OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Load it into current shell (important for Termux / nohup):

set -a
source .env
set +a

📥 Installation

python -m venv .venv
source .venv/bin/activate

pip install -e .

Verify:

lie-analyzer --help

▶️ Usage

1) Analyze a single file (manual test)

lie-analyzer one ./test.wav --threshold 7

Used mainly for:

  • Debugging
  • Demo recordings
  • Development testing

2) Continuous folder monitoring (recommended)

lie-analyzer scan \
  --interval 3 \
  --call-rec "/sdcard/MIUI/sound_recorder/call_rec" \
  --recordings "/sdcard/Recordings" \
  --meta-ai "/sdcard/Download/Meta AI" \
  --threshold 7

This mode:

  • Continuously monitors predefined folders
  • Automatically detects new recordings
  • Waits for file write completion (prevents half-written files)
  • Triggers analysis + alerts when needed

📱 Termux Background Running

Recommended for mobile usage.

Start background monitor

nohup lie-analyzer scan \
  --interval 3 \
  --call-rec "/sdcard/MIUI/sound_recorder/call_rec" \
  --recordings "/sdcard/Recordings" \
  --meta-ai "/sdcard/Download/Meta AI" \
  --threshold 7 \
  > lie_analyzer.log 2>&1 &

echo "PID=$!"

View live log

tail -f lie_analyzer.log

Stop

pkill -f "lie-analyzer scan"

⚠️ Notes

  • If your audio is too short, the LLM may refuse to give a score. Provide longer speech.
  • For .mp4 videos, the pipeline will extract audio first (ffmpeg required).

License

MIT (or your preferred license)

About

AI 測謊/可信度分析工具:語音轉文字(Whisper)+語意評分+通報系統(A GPT-based lie / credibility analysis toolkit for audio & transcripts (Whisper + scoring + alerts).)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors