2GPT / GPT1
Hugorowan's picture
Create GPT1
c223b0d
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()