Test / app.py
Ankush05's picture
Update app.py
d7e046c verified
raw
history blame
285 Bytes
rom transformers import GPT2LMHeadModel, GPT2Tokenizer
model_id = "gpt2"
model = GPT2LMHeadModel.from_pretrained(model_id)
tokenizer = GPT2Tokenizer.from_pretrained(model_id)
text = "Hello"
encoded_text = tokenizer(text, return_tensors="pt")
outputs = model(**encoded_text)