Dzeniks commited on
Commit
9467970
·
1 Parent(s): 2e23b12

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +24 -0
README.md CHANGED
@@ -22,6 +22,30 @@ The model takes a claim and corresponding evidence as input and returns a label
22
 
23
  To use the Roberta-Fact-Check Model, you can simply pass in a claim and evidence as input to the model and receive a label indicating whether the evidence supports or refutes the claim. The model can be integrated into various applications for fact-checking and misinformation detection.
24
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  ## Acknowledgements
26
 
27
  This model was developed using the Hugging Face transformers library and trained on the FEVER and Hover datasets. We would like to thank the developers of these datasets for their contributions to the community.
 
22
 
23
  To use the Roberta-Fact-Check Model, you can simply pass in a claim and evidence as input to the model and receive a label indicating whether the evidence supports or refutes the claim. The model can be integrated into various applications for fact-checking and misinformation detection.
24
 
25
+ ```python
26
+ import torch
27
+ from transformers import RobertaTokenizer, RobertaForSequenceClassification
28
+
29
+ # Load the tokenizer and model
30
+ tokenizer = RobertaTokenizer.from_pretrained('Dzeniks/roberta-fact-check')
31
+ model = RobertaForSequenceClassification.from_pretrained('Dzeniks/roberta-fact-check')
32
+
33
+ # Define the claim with evidence to classify
34
+ claim = "Albert Einstein work in the field of computer science"
35
+ evidence = "Albert Einstein was a German-born theoretical physicist, widely acknowledged to be one of the greatest and most influential physicists of all time."
36
+
37
+ # Tokenize the claim with evidence
38
+ x = tokenizer.encode_plus(claim, evidence, return_tensors="pt")
39
+
40
+ model.eval()
41
+ with torch.no_grad():
42
+ prediction = model(**x)
43
+
44
+ label = torch.argmax(outputs[0]).item()
45
+
46
+ print(f"Label: {label}")
47
+ ```
48
+
49
  ## Acknowledgements
50
 
51
  This model was developed using the Hugging Face transformers library and trained on the FEVER and Hover datasets. We would like to thank the developers of these datasets for their contributions to the community.