import gradio as gr from transformers import pipeline pipe = pipeline("text2text-generation", model="lmsys/fastchat-t5-3b-v1.0") def predict(text, history): return pipe(text)[0]["generated_text"] gr.ChatInterface( fn = predict, chatbot=gr.Chatbot(height=800), textbox=gr.Textbox(placeholder="", container=False, scale=7), title="Enter your question", description="Ask a question to the following model: lmsys/fastchat-t5-3b-v1.0", theme="soft", retry_btn=None, undo_btn="Delete Previous", clear_btn="Clear" ).launch()