Test / app.py
Ankush05's picture
Update app.py
e7799a9 verified
raw
history blame contribute delete
287 Bytes
from 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)