Skip to content

Qasim-afzaal/AI-PDF-Report-Generator-Using-Flutter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AI PDF Report Generator Using Flutter

A Flutter application integrated with an AI backend to generate roof construction estimation reports in PDF format. The AI is trained to ask relevant questions, process responses, and create detailed reports accessible via API. The app allows users to interact with the AI, view reports, and download them seamlessly.


Features

  • AI-Powered Model: A trained AI model to ask domain-specific questions and analyze responses.
  • Custom API Integration: Backend API for communicating with the AI model and fetching reports.
  • Dynamic PDF Reports: Generates structured, professional estimation reports in PDF format.
  • Download and Share Reports: View, download, or share reports directly from the app.
  • Cloud Integration: Firebase services for user authentication, data storage, and analytics.

Architecture Overview

The project integrates a backend AI service with the Flutter frontend. The workflow is as follows:

  1. AI Model Training:

    • The AI model is trained using domain-specific datasets related to roof construction and estimation.
    • It generates questions and processes user responses to estimate construction details.
  2. Backend API:

    • A RESTful API serves as a bridge between the Flutter app and the AI model.
    • The API handles:
      • Accepting user inputs.
      • Communicating with the AI model.
      • Generating estimation reports.
      • Returning the generated PDF URL to the app.
  3. Frontend (Flutter App):

    • Interacts with the API for AI-powered questions and report generation.
    • Downloads, views, and manages generated PDF reports.

API Details

Base URL

https://your-api-domain.com/

Endpoints

  1. Post User Responses
    Submit user inputs for report generation.
    Endpoint: /generate-report
    Method: POST
    Payload:

    {
      "questions": [
        {"question_id": 1, "answer": "Answer 1"},
        {"question_id": 2, "answer": "Answer 2"}
      ]
    }

    Response:

    {
      "status": "success",
      "report_url": "https://your-api-domain.com/reports/report123.pdf"
    }
  2. Fetch Report Status
    Check the status of report generation.
    Endpoint: /report-status
    Method: GET
    Parameters: report_id
    Response:

    {
      "status": "completed",
      "progress": 100
    }

Project Structure

Backend

The AI model is trained using frameworks like TensorFlow or PyTorch, and the API is built with a backend framework such as Flask, FastAPI, or Node.js.
Key Components:

  • AI Model: Processes user inputs and generates responses.
  • API: Facilitates communication between the AI model and the Flutter app.
  • Database: Stores questions, user responses, and report data.

Frontend

The Flutter app interacts with the backend via API and provides a user-friendly interface.


Dependencies

Flutter App

  • dio: For API calls.
  • flutter_pdfview: For viewing PDFs.
  • path_provider: For file storage.
  • provider: For state management.
  • firebase_*: For analytics, authentication, and cloud storage.

Backend

  • AI Frameworks: TensorFlow or PyTorch for model training.
  • API Framework: Flask or FastAPI for serving AI functionalities.
  • PDF Library: Libraries like ReportLab (Python) or PDFKit (Node.js) for generating PDFs.

Usage

Steps in the App:

  1. Answer Questions: Users respond to AI-generated questions about roof construction.
  2. Generate Report: The app sends responses to the backend API for processing.
  3. Download PDF: Once the report is generated, users can view or download it directly.

Backend Workflow:

  1. Receive Input: User responses are submitted via the API.
  2. AI Processing: The AI model analyzes inputs and calculates estimations.
  3. Generate Report: The backend generates a PDF using the processed data.
  4. Return Report URL: The API responds with the PDF URL for the Flutter app.

Example Code

API Call in Flutter

import 'package:dio/dio.dart';

Future<void> generateReport(List<Map<String, String>> answers) async {
  final dio = Dio();
  final response = await dio.post(
    'https://your-api-domain.com/generate-report',
    data: {
      "questions": answers,
    },
  );

  if (response.statusCode == 200) {
    final reportUrl = response.data['report_url'];
    print('Report generated: $reportUrl');
    // Download or view the report using the URL
  } else {
    print('Failed to generate report');
  }
}

Future Enhancements

  • Enhanced AI Model: Train with more datasets for improved accuracy.
  • Offline Mode: Enable local report generation when the internet is unavailable.
  • Multi-language Support: Make the AI accessible in multiple languages.
  • Custom Branding: Allow customization of PDF templates.

Contributing

  1. Fork the repository.
  2. Create a feature branch: git checkout -b feature-name.
  3. Commit changes: git commit -m 'Add feature'.
  4. Push to branch: git push origin feature-name.
  5. Open a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for more details.


Acknowledgments

  • TensorFlow/PyTorch for AI model training.
  • Flutter for the seamless cross-platform UI.
  • Firebase for backend services.
  • API framework authors for enabling robust communication.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published