Spaces:
Build error
Build error
File size: 583 Bytes
11e8444 0fac6f6 5d8baf5 0fac6f6 8f486ee 5d8baf5 8f486ee fd66c83 8f486ee 0fac6f6 11e8444 0fac6f6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | import gradio as gr
from src import *
model = ModelLoader()
prediction = PredictionServices(model.Model, model.Tokenizer)
def single_predict(text):
print(text)
preds = prediction.single_predict(text)
toxic_pred = float(preds)
non_toxic_pred = float(1-toxic_pred)
rslt = {"Toxic":toxic_pred,"Non Toxic":non_toxic_pred}
return rslt
app = gr.Interface(inputs=gr.Textbox(label="Enter Comment"),
fn=single_predict,
outputs=[gr.Label('Probabilities')],
title="Toxic Comment Classifier")
app.launch()
|