There-Is-A-Chat / app.py
Peeble's picture
Create app.py
9763434 verified
raw
history blame contribute delete
476 Bytes
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()