--- language: - id tags: - indobert - indobenchmark - indonlu --- This is the first classification of sentiment analysis for police new task ### How to import ```python import torch from transformers import BertForSequenceClassification, BertTokenizer, BertConfig, pipeline # Load the tokenizer and model tokenizer = BertTokenizer.from_pretrained("nfhakim/police-sentiment-c1-v2") config = BertConfig.from_pretrained("nfhakim/police-sentiment-c1-v2") model = BertForSequenceClassification.from_pretrained("nfhakim/police-sentiment-c1-v2", config=config) ``` ### How to use ```python # Initialize the pipeline nlp = pipeline("text-classification", model=model, tokenizer=tokenizer) # Define a function to handle input text def classify_text(text): # Tokenize the text and truncate to the first 512 tokens if necessary inputs = tokenizer(text, truncation=True, max_length=512, return_tensors="pt") # Use the model to classify the text results = nlp(inputs['input_ids']) return results # Example usage input_text = "Your input text here" output = classify_text(input_text) print(output) ```