Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from transformers import pipeline
|
| 2 |
+
import gradio as gr
|
| 3 |
+
|
| 4 |
+
# Load model
|
| 5 |
+
classifier = pipeline("text-classification", model="your-username/octagon")
|
| 6 |
+
|
| 7 |
+
def predict(text):
|
| 8 |
+
return classifier(text)
|
| 9 |
+
|
| 10 |
+
iface = gr.Interface(
|
| 11 |
+
fn=predict,
|
| 12 |
+
inputs=gr.Textbox(lines=2, placeholder="Enter text here..."),
|
| 13 |
+
outputs="label",
|
| 14 |
+
title="Octagon Text Classification",
|
| 15 |
+
description="A demo for the Octagon model trained on IMDB reviews."
|
| 16 |
+
)
|
| 17 |
+
|
| 18 |
+
iface.launch()
|