Spaces:
Sleeping
Sleeping
Create app.py
Browse files123456789101112131415161718import gradio as grfrom transformers import pipeline
pipeline = pipeline(task="text-classification", model="MichalMlodawski/nsfw-text-detection-large")
def predict(input_txt): predictions = pipeline(input_txt) return input_txt, {p["label"]: p["score"] for p in predictions}
gradio_app = gr.Interface( predict, inputs=gr.Textbox(label="Enter text"), outputs=[gr.Label(label="Result", num_top_classes=2)], title="NSFW Classifier",)
if __name__ == "__main__": gradio_app.launch()app.pyAdded+18