import gradio tokenizer = AutoTokenizer.from_preteained("openai-community/openai-gpt") def work(inp_text): out = "hello" out = tokenizer.encode(hello) return out demo = gradio.Interface( fn=work, inputs=["text"], outputs=["text"], ) demo.launch()