import gradio as gr from transformers import pipeline clf = pipeline("text-classification", model="AjayPlus/propaganda-detector-v2") def predict(text): return clf(text) with gr.Blocks() as demo: with gr.Row(): input_text = gr.Textbox(label="Enter a sentence") output_json = gr.JSON(label="Prediction") input_text.submit(predict, input_text, output_json) demo.queue() demo.launch(show_api=True)