From 861e003422357304c4de410274834918774471e9 Mon Sep 17 00:00:00 2001 From: Vishnu Priyan S S Date: Tue, 29 Jul 2025 18:47:16 -0500 Subject: [PATCH 1/2] docs(showcase): add docs/showcase/fact-pulse.mdx for Fact Dynamics project --- docs/showcase/fact-dynamics.mdx | 179 ++++++++++++++++++++++++++++++++ 1 file changed, 179 insertions(+) create mode 100644 docs/showcase/fact-dynamics.mdx diff --git a/docs/showcase/fact-dynamics.mdx b/docs/showcase/fact-dynamics.mdx new file mode 100644 index 0000000..896a4f6 --- /dev/null +++ b/docs/showcase/fact-dynamics.mdx @@ -0,0 +1,179 @@ +--- +title: Fact Dynamics +description: A Flutter app for real-time fact-checking of debate, speech and images uses Perplexity's Sonar API. +sidebar_position: 2 +keywords: [Sonar API, Flutter, Dart, fact‑checking, hackathon, real-time, speech-to-text, image-verification] +--- + +# Fact Dynamics + +

+ Fact Dynamics logo +

+ +Fact Dynamics is a cross‑platform Flutter application that leverages Perplexity's Sonar API to provide real‑time fact‑checking for spoken and visual content—perfect for debates, presentations, or on‑the‑fly image verification. Built as a Perplexity Hackathon submission in the Information Tools & Deep Research & Education categories. + +## Features + +- **Real‑time Speech Analysis** - Transcribes live audio (via `speech_to_text`) and fact‑checks each snippet instantly +- **Image Fact Verification** - Extracts text from images and verifies claims on‑device +- **Claim Rating System** - Classifies claims as **TRUE**, **FALSE**, **MISLEADING**, or **UNVERIFIABLE** +- **Source Citations** - Surfaces authoritative URLs backing each verdict +- **User Authentication** - Firebase Auth (Google & Email) with secure Firestore persistence +- **Debate Mode** - Continuous speech recognition with streaming feedback +- **Cross‑platform** - iOS, Android, Web (macOS testing; Windows coming soon) + +## Prerequisites + +- Flutter SDK installed on your development machine +- Firebase account for authentication and data persistence +- Perplexity Sonar API key +- Device with microphone access for speech recognition +- Camera access for image capture (optional) + +## Installation + +1. **Clone the repository** + ```bash + git clone https://github.com/vishnu32510/fact_pulse.git + cd fact_pulse + ``` + +2. **Install Flutter dependencies** + ```bash + flutter pub get + ``` + +3. **Configure Firebase for your platform** + - Create a Firebase project at [Firebase Console](https://console.firebase.google.com/) + - Enable Authentication (Google, Email) and Firestore Database + - Install and configure FlutterFire CLI: + ```bash + dart pub global activate flutterfire_cli + flutterfire configure + ``` + - Follow the prompts to select your Firebase project and platforms (iOS/Android/Web) + +4. **Set up API key** + - Create a `.env` file in the project root (use `.env.template` as reference) + - Add your Perplexity Sonar API key: + ``` + PERPLEXITY_API_KEY=your_api_key_here + ``` + +5. **Configure platform permissions** + - For Android: Microphone and camera permissions are configured in `android/app/src/main/AndroidManifest.xml` + - For iOS: Permissions are configured in `ios/Runner/Info.plist` + +6. **Run the application** + ```bash + flutter run + ``` + +## Usage + +### Demo & Screenshots + +- [Watch the demo video](https://youtu.be/92IoX19Djtc) +- [Web Demo](https://fact-pulse.web.app/) + + + + + + + +
+ Login screen + + Dashboard + + Profile screen +
+ + + + + + +
+ Facts checked list + + Fact checks screen +
+ +1. **Authentication**: Sign in with Google or email through Firebase Auth +2. **Speech Mode**: Tap the microphone to start real-time speech transcription and fact-checking +3. **Image Mode**: Upload an image or provide a URL to extract and verify text claims +4. **Debate Mode**: Enable continuous speech recognition for live debate fact-checking +5. **View Results**: Check claim ratings, explanations, and source citations + +## Code Explanation + +### Perplexity Sonar API Integration + +The app integrates with Perplexity's Sonar API in two main ways: + +1. **Debate Fact‑Checking** + - Stream 5‑second audio chunks → transcribe → send `textSnippet` to Sonar + - Parse JSON response for `{ claim, rating, explanation, sources }` + +2. **Image Analysis** + - Upload or URL‑point to image → Sonar extracts on‑image text → verify each claim + +```dart +final client = PerplexityClient(apiKey: env.SONAR_API_KEY); +final response = await client.analyzeClaim(textSnippet); +print('Rating: ${response.rating}, Confidence: ${response.confidence}'); +``` + +The app processes audio in real-time, transcribes it using Flutter's speech-to-text package, and sends each snippet to the Sonar API for immediate fact verification with source citations. + +### Custom SDKs Used + +This project uses custom-built Perplexity API SDKs developed specifically for this hackathon: +- **perplexity_dart** - Core Dart SDK ([pub.dev](https://pub.dev/packages/perplexity_dart), [docs](perplexity-flutter)) +- **perplexity_flutter** - Flutter widgets and utilities ([pub.dev](https://pub.dev/packages/perplexity_flutter), [docs](perplexity-flutter)) + +## Links + +- [GitHub Repository](https://github.com/vishnu32510/fact_pulse) +- [Live Demo](https://fact-pulse.web.app/) +- [Devpost Submission](https://devpost.com/software/fact-dynamics) +- [Demo Video](https://youtu.be/92IoX19Djtc) + +## Limitations + +- Speech recognition accuracy depends on audio quality and background noise +- Fact-checking is limited to claims that can be verified through available online sources +- Image text extraction quality varies based on image resolution and text clarity +- Real-time processing may experience latency depending on network connectivity +- Cross-platform compatibility is still being tested for macOS and Windows +- API rate limits may affect continuous usage in high-volume scenarios +- Android microphone access permissions need to be added for long duration listening From 994045f6363e27b864483c3dda04d353a19b8740 Mon Sep 17 00:00:00 2001 From: Vishnu Priyan S S Date: Sat, 2 Aug 2025 01:00:39 -0500 Subject: [PATCH 2/2] chore: fact dynamics mdx refine --- docs/showcase/fact-dynamics.mdx | 184 ++++++++++---------------------- 1 file changed, 55 insertions(+), 129 deletions(-) diff --git a/docs/showcase/fact-dynamics.mdx b/docs/showcase/fact-dynamics.mdx index 896a4f6..cb16045 100644 --- a/docs/showcase/fact-dynamics.mdx +++ b/docs/showcase/fact-dynamics.mdx @@ -1,12 +1,11 @@ --- -title: Fact Dynamics -description: A Flutter app for real-time fact-checking of debate, speech and images uses Perplexity's Sonar API. +title: Fact Dynamics | Real-time Fact-Checking Flutter App +description: Cross-platform app for real-time fact-checking of debates, speeches, and images using Perplexity's Sonar API sidebar_position: 2 -keywords: [Sonar API, Flutter, Dart, fact‑checking, hackathon, real-time, speech-to-text, image-verification] +keywords: [Fact Dynamics, fact-checking, Flutter, Dart, real-time, speech-to-text, debate, image verification] --- -# Fact Dynamics - +# Fact Dynamics | Real-time Fact-Checking Flutter App

-Fact Dynamics is a cross‑platform Flutter application that leverages Perplexity's Sonar API to provide real‑time fact‑checking for spoken and visual content—perfect for debates, presentations, or on‑the‑fly image verification. Built as a Perplexity Hackathon submission in the Information Tools & Deep Research & Education categories. +**Hackathon Submission** - Built for Perplexity Hackathon in Information Tools & Deep Research categories. + +Fact Dynamics is a cross-platform Flutter app that provides real-time fact-checking for spoken content and images. Perfect for live debates, presentations, and on-the-fly information verification. + ## Features -- **Real‑time Speech Analysis** - Transcribes live audio (via `speech_to_text`) and fact‑checks each snippet instantly -- **Image Fact Verification** - Extracts text from images and verifies claims on‑device -- **Claim Rating System** - Classifies claims as **TRUE**, **FALSE**, **MISLEADING**, or **UNVERIFIABLE** -- **Source Citations** - Surfaces authoritative URLs backing each verdict -- **User Authentication** - Firebase Auth (Google & Email) with secure Firestore persistence -- **Debate Mode** - Continuous speech recognition with streaming feedback -- **Cross‑platform** - iOS, Android, Web (macOS testing; Windows coming soon) +* Real-time speech transcription and fact-checking during live conversations +* Image text extraction and claim verification with source citations +* Claim rating system (TRUE, FALSE, MISLEADING, UNVERIFIABLE) with explanations +* Source Citations** - Provides authoritative URLs backing each verdict + +* Debate mode with continuous speech recognition and streaming feedback +* User authentication via Firebase (Google, Email) with persistent chat history +* Cross-platform support for iOS, Android, and Web ## Prerequisites -- Flutter SDK installed on your development machine -- Firebase account for authentication and data persistence -- Perplexity Sonar API key -- Device with microphone access for speech recognition -- Camera access for image capture (optional) - -## Installation - -1. **Clone the repository** - ```bash - git clone https://github.com/vishnu32510/fact_pulse.git - cd fact_pulse - ``` - -2. **Install Flutter dependencies** - ```bash - flutter pub get - ``` - -3. **Configure Firebase for your platform** - - Create a Firebase project at [Firebase Console](https://console.firebase.google.com/) - - Enable Authentication (Google, Email) and Firestore Database - - Install and configure FlutterFire CLI: - ```bash - dart pub global activate flutterfire_cli - flutterfire configure - ``` - - Follow the prompts to select your Firebase project and platforms (iOS/Android/Web) - -4. **Set up API key** - - Create a `.env` file in the project root (use `.env.template` as reference) - - Add your Perplexity Sonar API key: - ``` - PERPLEXITY_API_KEY=your_api_key_here - ``` - -5. **Configure platform permissions** - - For Android: Microphone and camera permissions are configured in `android/app/src/main/AndroidManifest.xml` - - For iOS: Permissions are configured in `ios/Runner/Info.plist` - -6. **Run the application** - ```bash - flutter run - ``` +* Flutter SDK 3.0.0 or newer +* Dart SDK 2.17.0 or newer +* Firebase CLI for authentication and database setup +* Perplexity API key for Sonar integration +* Device with microphone access for speech recognition + +## Installation (Follow Detailed guideline on the Repository) + +```bash +git clone https://github.com/vishnu32510/fact_pulse.git +cd fact_pulse +flutter pub get +``` ## Usage -### Demo & Screenshots +**Real-time Speech Fact-Checking:** +- Streams 5-second audio chunks through Flutter's `speech_to_text` +- Sends transcribed snippets to Sonar API with structured prompts +- Returns JSON with claims, ratings (TRUE/FALSE/MISLEADING/UNVERIFIABLE), explanations, and sources -- [Watch the demo video](https://youtu.be/92IoX19Djtc) -- [Web Demo](https://fact-pulse.web.app/) +**Image Analysis:** +- Uploads images/URLs to Sonar API for text extraction +- Verifies extracted claims against authoritative sources +- Provides comprehensive analysis with source attribution + +## Screenshots - - - -
- Login screen - - Profile screen -
- - - -
- Facts checked list - Fact checks screen
-1. **Authentication**: Sign in with Google or email through Firebase Auth -2. **Speech Mode**: Tap the microphone to start real-time speech transcription and fact-checking -3. **Image Mode**: Upload an image or provide a URL to extract and verify text claims -4. **Debate Mode**: Enable continuous speech recognition for live debate fact-checking -5. **View Results**: Check claim ratings, explanations, and source citations - ## Code Explanation -### Perplexity Sonar API Integration - -The app integrates with Perplexity's Sonar API in two main ways: +* Frontend: Flutter with BLoC pattern for state management targeting iOS, Android, and Web +* Backend: Firebase (Firestore, Authentication) for user data and chat history persistence +* Speech Processing: speech_to_text package for real-time audio transcription +* API Integration: Custom Dart client calling Perplexity Sonar API with structured prompts +* Image Processing: Built-in image picker with base64 encoding for multimodal analysis +* Data Architecture: Firestore collections per user with subcollections for debates, speeches, and images -1. **Debate Fact‑Checking** - - Stream 5‑second audio chunks → transcribe → send `textSnippet` to Sonar - - Parse JSON response for `{ claim, rating, explanation, sources }` +## Open Source SDKs -2. **Image Analysis** - - Upload or URL‑point to image → Sonar extracts on‑image text → verify each claim - -```dart -final client = PerplexityClient(apiKey: env.SONAR_API_KEY); -final response = await client.analyzeClaim(textSnippet); -print('Rating: ${response.rating}, Confidence: ${response.confidence}'); -``` +Built two reusable packages for the Flutter community: +- **[perplexity_dart](https://pub.dev/packages/perplexity_dart)** - Core Dart SDK for Perplexity API +- **[perplexity_flutter](https://pub.dev/packages/perplexity_flutter)** - Flutter widgets and BLoC integration -The app processes audio in real-time, transcribes it using Flutter's speech-to-text package, and sends each snippet to the Sonar API for immediate fact verification with source citations. - -### Custom SDKs Used - -This project uses custom-built Perplexity API SDKs developed specifically for this hackathon: -- **perplexity_dart** - Core Dart SDK ([pub.dev](https://pub.dev/packages/perplexity_dart), [docs](perplexity-flutter)) -- **perplexity_flutter** - Flutter widgets and utilities ([pub.dev](https://pub.dev/packages/perplexity_flutter), [docs](perplexity-flutter)) ## Links -- [GitHub Repository](https://github.com/vishnu32510/fact_pulse) -- [Live Demo](https://fact-pulse.web.app/) -- [Devpost Submission](https://devpost.com/software/fact-dynamics) -- [Demo Video](https://youtu.be/92IoX19Djtc) - -## Limitations - -- Speech recognition accuracy depends on audio quality and background noise -- Fact-checking is limited to claims that can be verified through available online sources -- Image text extraction quality varies based on image resolution and text clarity -- Real-time processing may experience latency depending on network connectivity -- Cross-platform compatibility is still being tested for macOS and Windows -- API rate limits may affect continuous usage in high-volume scenarios -- Android microphone access permissions need to be added for long duration listening +- **[GitHub Repository](https://github.com/vishnu32510/fact_pulse)** - Full source code +- **[Live Demo](https://fact-pulse.web.app/)** - Try the web version +- **[Demo Video](https://youtu.be/92IoX19Djtc)** - Watch it in action +- **[Devpost Submission](https://devpost.com/software/fact-dynamics)** - Hackathon entry \ No newline at end of file