Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import mlflow.pyfunc
|
| 2 |
+
import gradio as gr
|
| 3 |
+
|
| 4 |
+
# Load the model from MLflow registry
|
| 5 |
+
model = mlflow.pyfunc.load_model("models:/bert-toxic-classifier/1")
|
| 6 |
+
|
| 7 |
+
def classify(text):
|
| 8 |
+
return model.predict([text])[0]
|
| 9 |
+
|
| 10 |
+
gr.Interface(
|
| 11 |
+
fn=classify,
|
| 12 |
+
inputs=gr.Textbox(label="Enter your comment"),
|
| 13 |
+
outputs=gr.Textbox(label="Prediction"),
|
| 14 |
+
title="Toxic Comment Classifier"
|
| 15 |
+
).launch()
|