Create Talk1
Browse files
Talk1
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()
|