File size: 452 Bytes
2d1251a
 
 
 
9ec12c7
2d1251a
 
 
 
 
 
 
 
 
 
 
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 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()