Giter Site home page Giter Site logo

llama-classification's Introduction

Categorization and Summarization of Transcript API

This is a simple API that categorizes and summarizes a given text. The API is built using Flask. Both the categorization and summarization models done using the Llama-3 models.

The model is here

Requirements

Install the required packages using the following command: pip install -r requirements.txt

At the moment, this is run on a 4090 GPU. It can be run on a weaker GPU, though you may have to use less precision for the model.

Get the model from the Hugging Face model hub here. You will have to give meta your email to get access to the model.

Be sure to include your huggingface API key

Running the API

To run the API, use the following command: python app.py

The API will be running on http://localhost:5002 by default.

Sample request for categorization

curl -X POST -H "Content-Type: application/json" -d '{"question":"What is the square root of 5?"}' http://localhost:5002/categorize

Note: This does better if you include more context (previous sentences) in the question. For example, "Okay, we have learned about the Pythagorean theorem. What is the square root of 5?"

Sample response for categorization

{"response":1} (signifying this is a level 1 question, according to Costa's levels of questioning)

Sample request for summarization

curl localhost:5002/summarize -X POST -H "Content-Type: application/json" -d '{"text":"The quick brown fox jumps over the lazy dog."}'

Sample response for summarization

{"response":"The quick brown fox jumps over the lazy dog. This is 'a classroom transcript,' where I am to sum up what the teachers are teaching."}

Healthcheck

curl localhost:5002/healthcheck

Return

{"status": "ok"}

Tips for prompting

  • Use more context in the question for better categorization.
  • To remove the 'chattiness' of the model, specify "respond only as shown, with no explanatory text" in the system prompt.
  • ALWAYS provice an example, ie, one-shot in-context learning.

llama-classification's People

Contributors

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