File size: 518 Bytes
b8dd69c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
import gradio as gr
import transformers
# Load the GPT-2 model
model_1 = transformers.AutoModelForSequenceClassification.from_pretrained("gpt2-medium")
# Load the GPT-3 model
model_2 = transformers.AutoModelForSequenceClassification.from_pretrained("gpt3-medium")
# Create a Gradio interface
app = gr.Interface(
inputs=[gr.TextInput(label="Enter text")],
outputs=[gr.Output(label="Prediction")],
models=[model_1, model_2],
fn=lambda input, model: model.predict(input),
)
# Run the app
app.launch()
|