File size: 382 Bytes
c223b0d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import gradio as gr
import transformers

# Load the GPT-2 model
model = transformers.AutoModelForSequenceClassification.from_pretrained("gpt2-medium")

# Create a Gradio interface
app = gr.Interface(
    inputs=[gr.TextInput(label="Enter text")],
    outputs=[gr.Output(label="Prediction")],
    model=model,
    fn=lambda input: model.predict(input),
)

# Run the app
app.launch()