archanaachu776 commited on
Commit
17649e2
·
verified ·
1 Parent(s): c207d36

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +15 -0
README.md CHANGED
@@ -86,3 +86,18 @@ Users should validate predictions before using them in critical decision-making
86
 
87
  ```bash
88
  pip install transformers peft torch
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
 
87
  ```bash
88
  pip install transformers peft torch
89
+
90
+
91
+ from transformers import AutoTokenizer, AutoModelForCausalLM
92
+
93
+ model_id = "archanaachu776/sentiment-analyzer"
94
+
95
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
96
+ model = AutoModelForCausalLM.from_pretrained(model_id)
97
+
98
+ text = "The product quality is excellent and I am very happy."
99
+
100
+ inputs = tokenizer(text, return_tensors="pt")
101
+ outputs = model.generate(**inputs, max_new_tokens=50)
102
+
103
+ print(tokenizer.decode(outputs[0], skip_special_tokens=True))