import gradio as gr from transformers import pipeline pipeline = pipeline(task="text-generation", model="starcoder2-15b") def chatbot(input_text): generated_text = pipeline(input_text, max_length=50) return input_text, "Chatbot: " + generated_text[0]["generated_text"] chatbot_app = gr.Interface( chatbot, inputs=gr.Textbox(lines=2, label="You:"), outputs=gr.Textbox(label="Chatbot:", placeholder="Chatbot's response will appear here..."), title="Chatbot UI" ) if __name__ == "__main__": chatbot_app.launch()