Spaces:
Sleeping
Sleeping
File size: 386 Bytes
2af52d7 e765751 2af52d7 e765751 2af52d7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 |
from transformers import GPT2Tokenizer, GPT2Model
tokenizer = GPT2Tokenizer.from_pretrained('gpt2')
model = GPT2Model.from_pretrained('gpt2')
import gradio as gr
def gpt2(string):
text = string
encoded_input = tokenizer(text, return_tensors='pt')
output = model(**encoded_input)
return output
iface = gr.Interface(fn=gpt2, inputs="text", outputs="text")
iface.launch() |