import gradio as gr from transformers import pipeline pipe = pipeline( "text-generation", model="microsoft/Phi-3-mini-4k-instruct" ) def chat(message,history): response = pipe(message,max_new_tokens=150)[0]["generated_text"] return response demo = gr.ChatInterface(fn=chat,title="Simple CPU chatbot") demo.launch()