File size: 538 Bytes
056935b
d8e0ea6
5107fc6
fd58eaa
 
5107fc6
d8e0ea6
 
 
 
d284da3
d8e0ea6
 
 
 
 
 
 
 
056935b
d8e0ea6
d284da3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import gradio as gr
from transformers import pipeline

# Load a lightweight model
chatbot = pipeline("text-generation", model="distilgpt2")

# Define the chatbot function
def chat(input_text):
    response = chatbot(input_text, max_length=100, do_sample=True)
    return response[0]["generated_text"]

# Create the Gradio interface
interface = gr.Interface(
    fn=chat,
    inputs="text",
    outputs="text",
    title="Chat with an LLM",
    description="Type your message and chat with the LLM!"
)

# Launch the app
interface.launch()