MonaHamid commited on
Commit
6d2b52c
·
verified ·
1 Parent(s): 6ed9b28

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -0
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()