from transformers import pipeline import json import gradio as gr def image_classifier(inp): pipe = pipeline(task='text-classification', model='s-nlp/russian_toxicity_classifier') out = pipe(inp) a = json.dumps(out[0]) return a demo = gr.Interface(fn=image_classifier, inputs="text", outputs="label") demo.launch(share=True)