Spaces:
Runtime error
Runtime error
import gradio as gr | |
from transformers import pipeline | |
# Load the model | |
chatbot = pipeline("text-generation", model="Xenova/gpt-3.5-turbo") | |
# Define the chat function | |
def chat_with_ai(prompt): | |
response = chatbot(prompt, max_length=50, num_return_sequences=1) | |
return response[0]['generated_text'] | |
# Create the Gradio interface | |
interface = gr.Interface(fn=chat_with_ai, inputs="text", outputs="text") | |
# Launch the interface | |
interface.launch() | |