This project uses a pretrained transformer model to summarize and classify text data efficiently. It can be used for natural language processing tasks such as text summarization and topic classification.
- Summarizes input text into a concise version
- Classifies text into predefined categories
- Uses Hugging Face transformers and pipelines
You can run this project in Google Colab or locally with Python installed. Required packages:
pip install transformers torch
## Usage
Here is a simple example of how to use the summarization and classification functions:
from transformers import pipeline
# Load summarization pipeline
summarizer = pipeline("summarization")
# Load text classification pipeline
classifier = pipeline("text-classification")
text = "Soft robotics integrates compliant materials and innovative design principles to create flexible and adaptive robotic systems."
# Summarize
summary = summarizer(text, max_length=50, min_length=10, do_sample=False)
print("Summary:", summary[0]['summary_text'])
# Classify
classification = classifier(text)
print("Classification:", classification)
Demo Output
Original Text:
Soft robotics integrates compliant materials and innovative design principles to create flexible and adaptive robotic systems.
Summarized:
Soft robotics uses soft materials and new design methods for adaptable robots.
Classification Result:
[{'label': 'TECHNOLOGY', 'score': 0.99}]
License
This project is licensed under the MIT License.