from fastai.text.all import * import gradio as gr model = load_learner("llmf.pkl") def txt_gen(txt, n_words=45, n_sents=2): a = [model.predict(txt,n_words,temperature=0.9) for _ in range(n_sents)] return "\n".join(a) sents = gr.components.Textbox() outs = gr.components.Textbox() examples=["جنگ جهانی دوم رو " ,"شعر و شاعری "] intf = gr.Interface(fn=txt_gen, inputs=sents, outputs=outs, examples=examples) intf.launch(inline=False)