This repository contains a Flask-based API for managing PDF files, analyzing architectural floor plans that drawn in AutoCAD, and interacting with various AI models. The API provides endpoints for uploading, retrieving, and deleting PDFs, as well as performing various analyses on the content of the PDFs.
- Upload, retrieve, and delete PDF files.
- Analyze architectural floor plans using AI models.
- Extract and map descriptions from floor plan legends.
- Summarize floor plan pages.
- Handle user feedback and contact requests.
- Integrate with Firebase for data storage and authentication.
- Use OpenAI for natural language processing tasks.
-
Clone the repository:
git clone https://github.com/your-repo/pdf-service-api.git cd pdf-service-api
-
Create and activate a virtual environment:
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install the dependencies:
pip install -r requirements.txt
-
Set up environment variables:
-
Run the application:
python app.py
Configuration settings are managed in config.py. You can set environment variables in the .env file to override default settings.
The API can be accessed at http://localhost:5000
. You can use tools like Postman or cURL to interact with the endpoints.
GET /pdfs
: Retrieve all PDFs.GET /pdfs/{pdf_id}
: Retrieve a specific PDF by ID.GET /pdfs/base64/{pdf_id}
: Retrieve a PDF's Base64-encoded content.POST /pdfs
: Upload a new PDF.DELETE /pdfs/{pdf_id}
: Delete a specific PDF by ID.PUT /pdfs/update
: Update an existing PDF's data.
POST /analyze-legend-roboflow
: Analyze the legend using the legend reading model.POST /analyze-floor-plans-roboflow
: Analyze floor plans using the Roboflow model.POST /decide-and-process-pdf_images
: Decide and process PDF images.POST /analyze-electrical-plans-roboflow
: Analyze electrical plans using the icon reading model.POST /segment-rooms-roboflow
: Analyze room plans using the Roboflow model.POST /segment-rooms-unet
: Analyze room plans using the UNet model.POST /analyze-floor-plans
: Analyze floor plans using the chat service.
POST /contact-us
: Save user feedback.
POST /analyzellm
: Analyze floor plans using the LLM service.
GET /products
: Retrieve all products.GET /products/{product_id}
: Retrieve a product by ID.POST /products
: Create a new product.DELETE /products/{product_id}
: Delete a product by ID.PUT /products/update
: Update an existing product.POST /products/update-prices
: Update product prices by fetching from the external API.GET /products/list/{object_key}
: List products filtered by their object key.
- ai_service.py: Handles AI-based image processing and analysis.
- chat_service.py: Manages interactions with OpenAI for analyzing floor plans.
- contact_service.py: Handles user feedback and contact requests.
- email_service.py: Sends email notifications.
- llm_service.py: Manages interactions with the LLM for various tasks.
- objectDetection.py: Handles object detection using YOLO models.
- pdf_service.py: Manages PDF-related operations.
- segment_service.py: Handles room segmentation using AI models.
- product_service.py: Manages product-related operations.
- firebase_models.py: Defines models for interacting with Firebase Firestore.
- image_preprocess.py: Contains functions for preprocessing images.
- llm_client.py: Manages interactions with the OpenAI API using Jinja2 templates.
This project is licensed under the MIT License. See the LICENSE file for more details.