Giter Site home page Giter Site logo

legallife's Introduction

LegalLife

This repository hosts the Flask backend and Frontend for the Legal Life project, which aims to assist legal professionals and users in document generation, analysis, and retrieval of legal information.

Introduction

Legal Life comprises a Flask-based backend that leverages various functionalities to interact with databases, perform semantic searches, and summarize legal documents.

Features

  1. Database Connectivity The backend connects to a MySQL database to retrieve legal documents and information. It uses the mysql.connector library to establish connections and execute SQL queries.

  2. Semantic Search Using the ChromaDB library, the backend offers semantic search capabilities. This functionality allows users to input queries and retrieve relevant legal documents based on semantics and context.

  3. Summary and Analysis The backend provides functionality to summarize and analyze legal documents. It aims to extract crucial details such as involved parties, timeframes, and key points from uploaded PDF or TXT files.

Requirements

Python 3.x: The backend is built using Python. Flask: Used for creating the API endpoints and handling requests. Flask-CORS: Enables Cross-Origin Resource Sharing for API requests. MySQL Connector: Required for connecting and interacting with the MySQL database. OpenAI's GPT-3.5 Model: Utilized for natural language processing tasks. ChromaDB: Used for semantic search functionality. Installation Cloning the Repository:

git clone https://github.com/Varda003/LegalLife.git

Installing Dependencies:

pip install -r requirements.txt

Database Setup:

Create a MySQL database named Law. Update the host, user, password, and database_name variables in the code with your database credentials. Usage Running the Application:

bash Copy code python app.py Endpoints:

/api: Receives legal queries and generates appropriate responses. /file: Accepts PDF or TXT files, extracts text, and provides a summary and analysis of the legal document. /search: Performs a semantic search within the connected legal document database. /searchDb: Searches the local MySQL database for specific legal terms. Code Explanation Database Connectivity (DbSearch) The DbSearch function establishes a connection to the MySQL database and performs a SQL query to retrieve relevant legal documents based on a search term. It showcases basic usage of the mysql.connector library.

Semantic Search (SementicSearch) This function utilizes ChromaDB's collection.query method to perform a semantic search within the stored documents based on user queries.

Summary and Analysis (summary and summaryBIG) These functions use OpenAI's GPT-3.5 model through the ask function to summarize legal texts, extracting key information, and presenting it in a formatted manner. summaryBIG handles larger texts by breaking them down into smaller chunks for processing.

Configuration

Ensure to provide the necessary API keys and configurations for OpenAI and ChromaDB. Replace placeholders like your_api_key with actual keys in the code.

Contributions

Contributions to enhance features or fix issues are welcome. Fork this repository, make changes, and create a pull request.

License

This project is licensed under the MIT License.

legallife's People

Contributors

varda003 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.