File size: 426 Bytes
8bbef8b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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)