import gradio as gr | |
from transformers import pipeline | |
chat = pipeline("text-generation", model="microsoft/phi-2") | |
def chat_with_model(prompt): | |
response = chat(prompt, max_length=50) | |
return response[0]['generated_text'] | |
demo = gr.ChatInterface(fn=chat_with_model, title="Echo Bot") | |
demo.launch() |