import gradio as gr from transformers import pipeline # Load ChatGPT model from Hugging Face chatbot = pipeline("conversational", model="gpt2") def chat_with_bot(user_input): response = chatbot(user_input) return response[0]['generated_text'] # Define the Gradio interface iface = gr.Interface(fn=chat_with_bot, inputs=gr.Textbox(label="Enter your message:"), outputs=gr.Textbox(label="Bot's response:")) iface.launch()