File size: 464 Bytes
fd638a4
325adf6
fd638a4
325adf6
 
fd638a4
325adf6
 
 
 
fd638a4
325adf6
 
 
 
e8122b5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import gradio as gr
from transformers import pipeline

# Load the model
generator = pipeline("text-generation", model="distilgpt2")

# Define the function for Gradio
def generate_text(prompt):
    result = generator(prompt, max_length=50, num_return_sequences=1)
    return result[0]["generated_text"]

# Create the Gradio interface
demo = gr.Interface(fn=generate_text, inputs="text", outputs="text", title="Simple LLM Chat")

# Launch the interface
demo.launch()