Arjun24420 commited on
Commit
383ea9a
1 Parent(s): b3db12e

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +31 -0
README.md ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## Model Details
2
+ This model is a Binart classification model fine-tuned on the FakeOrRealNews Dataset using the BERT (bert-base-uncased) architecture. The primary task is to classify news articles into different categories, making it suitable for fake news detection. BERT (Bidirectional Encoder Representations from Transformers) is a transformer-based model known for its effectiveness in natural language processing tasks.
3
+
4
+ It takes the title of the news article and classifies it into Reliable or Unreliable news.
5
+
6
+ Bias: The model may inherit biases present in the training data, and it's important to be aware of potential biases in the predictions.
7
+
8
+ ## Code Implementation
9
+ ```python
10
+ # Load model directly
11
+ from transformers import AutoTokenizer, AutoModelForSequenceClassification
12
+
13
+ tokenizer = AutoTokenizer.from_pretrained("Arjun24420/BERT-FakeOrReal-BinaryClassification")
14
+ model = AutoModelForSequenceClassification.from_pretrained("Arjun24420/BERT-FakeOrReal-BinaryClassification")
15
+
16
+ def predict(text):
17
+ # Tokenize the input text and move tensors to the GPU if available
18
+ inputs = tokenizer(text, padding=True, truncation=True,
19
+ max_length=512, return_tensors="pt")
20
+
21
+ # Get model output (logits)
22
+ outputs = model(**inputs)
23
+
24
+ probs = outputs.logits.softmax(1)
25
+ # Get the probabilities for each class
26
+ class_probabilities = {class_mapping[i]: probs[0, i].item()
27
+ for i in range(probs.shape[1])}
28
+
29
+ return class_probabilities
30
+
31
+ ```