Spaces:
Runtime error
Runtime error
from transformers import pipeline | |
# Load the conversational model | |
chatbot = pipeline("conversational", model="microsoft/DialoGPT-medium") | |
def respond(message): | |
# Construct a friendly prompt for Aya | |
prompt = f"You are Aya, a friendly AI that speaks in simple, clear language. You always respond positively and encouragingly. Here’s what the user says: {message} \nYour response:" | |
# Generate response | |
response = chatbot(prompt) | |
generated_text = response[-1]['generated_text'] | |
# Optionally add emojis and excitement | |
if "!" not in generated_text: | |
generated_text += " :3" | |
return generated_text | |