Hugorowan commited on
Commit
2476dae
·
1 Parent(s): c223b0d

Create GPT2

Browse files
Files changed (1) hide show
  1. GPT2 +19 -0
GPT2 ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import transformers
3
+
4
+ # Load the GPT-2 model
5
+ model_1 = transformers.AutoModelForSequenceClassification.from_pretrained("gpt2-medium")
6
+
7
+ # Load the GPT-3 model
8
+ model_2 = transformers.AutoModelForSequenceClassification.from_pretrained("gpt3-medium")
9
+
10
+ # Create a Gradio interface
11
+ app = gr.Interface(
12
+ inputs=[gr.TextInput(label="Enter text")],
13
+ outputs=[gr.Output(label="Prediction")],
14
+ models=[model_1, model_2],
15
+ fn=lambda input, model: model.predict(input),
16
+ )
17
+
18
+ # Run the app
19
+ app.launch()