Spaces:
Runtime error
Runtime error
File size: 476 Bytes
9763434 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | 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()
|