Giter VIP home page Giter VIP logo

pdf2qa-api's Introduction

PDF2QA-API

This repository consists of the modules necessary for the PDF2QA API endpoints.

Contents

  • requirements.txt contains the all modules required to run the API.
  • environment.yml contains the environment file required to set up a conda enviorment.
  • app/api/pdf2qaconverter.py contains the utility functions used by the API in the form of a class (All converter related functions can go here).
  • app/api/pdf2qa-api.py contains the API endpoint used to upload the PDF file (All API related functions can go here).
  • app/api/openai_key.env contains the OpenAI key stored as an environment variable. Create a .env file with the same name and store the key in the directory app/api.
    OPENAI_API_KEY=your_key_goes_here
    

Getting Started

  • Clone the repository.
  • Install Python by following the official guide.
  • Set up a virtual environment
    • Once you have Python installed, it is a good practice to create a virtual python environment. Virtual environments provide a clean working space for your Python packages to be installed so that you do not have conflicts with other libraries you install for other projects.
      To create a virtual environment, Python supplies a built in venv module which provides the basic functionality needed for the virtual environment setup. Running the command below will create a virtual environment named "pdf2qa-api-env" inside the current folder you have selected in your terminal / command line:

      python -m venv pdf2qa-api-env
      

      Once you've created the virtual environment, you neeed to activate it. On widnows, run:

      pdf2qa-api-env\Scripts\activate
      

      On Unix or MacOS, run:

      source pdf2qa-api-env/bin/activate
      

      Once, the environment is activated, run the following command to install libraries from the requirements.txt file:

      pip install -r requirements.txt
      
    • If using a conda environment, create a conda environment with the following command:

      conda env create -f environment.yml
      

      If the above command throws any error, please create the environment first using the command:

      conda create -n pdf2qa-api python=3.9.17
      

      Activate the conda environment by running the command:

      conda activate pdf2qa-api
      

      Then install the requirements file by running the command:

      pip install -r requirements.txt
      
  • Run the API on local server using uvicorn with the following command in the app/api/ directory:
    uvicorn pdf2qa-api:app --reload
    
  • To test the API endpoint, you can use tool like Postman.

pdf2qa-api's People

Contributors

supmathews 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.