GIGGeorg commited on
Commit
c9e2f63
·
verified ·
1 Parent(s): 29e64f4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -0
app.py CHANGED
@@ -1,3 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  pipe = pipeline(task="text-generation", model=model, tokenizer=tokenizer, max_length=100)
2
  prompt = "My name is Harry and I live in Winnipeg. My phone number is ummm 204 no 203, ahh 4344, no 4355"
3
  result = pipe(f"<s>[INST] {prompt} [/INST]")
 
1
+ from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline, logging
2
+ from huggingface_hub import notebook_login
3
+ notebook_login()
4
+ from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline, logging
5
+
6
+ # Ignore warnings
7
+ logging.set_verbosity(logging.CRITICAL)
8
+
9
+ # Load the model and tokenizer with authentication token
10
+ model_name = "King-Harry/NinjaMasker-PII-Redaction"
11
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
12
+ model = AutoModelForCausalLM.from_pretrained(model_name)
13
+
14
  pipe = pipeline(task="text-generation", model=model, tokenizer=tokenizer, max_length=100)
15
  prompt = "My name is Harry and I live in Winnipeg. My phone number is ummm 204 no 203, ahh 4344, no 4355"
16
  result = pipe(f"<s>[INST] {prompt} [/INST]")