Skip to content

radaisystems/mlops-takehome

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

AI-Powered Summarization Challenge

Create a FastAPI service that utilizes a pre-trained Hugging Face NLP model to perform text summarization on user-provided text inputs. The service should expose an API to receive text input and return a summary in a JSON response.

Requirements

  1. Environment Setup:

    • Set up a Python environment with the necessary dependencies (FastAPI, Hugging Face Transformers, or any other library you find appropriate)
  2. Model Selection:

    • Choose a pre-trained NLP model from the Hugging Face Model Hub that is suitable for text summarization.
  3. API Endpoint:

    • Implement an endpoint /summarize that:
      • Accepts a JSON input containing the user-provided text and a desired summary length.
      • Returns a JSON response with the summarized text.

    Example Request:

    {
      "text": "This is a long text input that needs to be summarized. The FastAPI service should be able to handle lengthy inputs and generate a coherent summary based on the user-defined summary length...",
      "summary_length": 50
    }

    Example Response:

    {
      "summary": "A brief summary of the lengthy input text, generated by the pre-trained Hugging Face model."
    }
  4. Containerization:

    • Containerize the FastAPI service using Docker.
    • Provide a Dockerfile and instructions on how to build and run the Docker container.
  5. Documentation:

    • Include a README file with clear instructions on how to set up and run the service.

Extension (Optional)

For candidates who wish to further demonstrate their technical abilities, implement the following additional functionality:

  1. Compressed Summary Endpoint:

    • Add a POST endpoint /compress_summary that:
      • Accepts the same input as /summarize.
      • Returns a compressed version of the summarized text.
  2. Compression Algorithm:

    • For each group of consecutive repeating characters in the summarized text:
      • If the group's length is 1, append the character to the compressed string.
      • Otherwise, append the character followed by the group's length.

    Example:

    • Original Summary:
      This committee meets annually to assess the effectiveness of policies on environmental protection.
    • Compressed Summary:
      This com2it2e2 me2ts an2ual2y to as2es2 the ef2ectivenes2 of policies on environmental protection.
    • Sample Output:
    {
      "summary": "This com2it2e2 me2ts an2ual2y to as2es2 the ef2ectivenes2 of policies on environmental protection."
    }

About

Take-home assignment for MLOps Engineering roles

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published