File size: 1,067 Bytes
dca838e
 
70ab481
 
 
 
19eb52f
70ab481
 
 
d66b3f1
 
5c4c0f2
 
 
70ab481
dca838e
5c4c0f2
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import gradio as gr

description = "Political tweet classifier"
title = "Determine whether a tweet skews Republican or Democratic"
examples = [["Team Biden would rather fund the Ayatollah's Death to America regime than allow Americans to produce energy for our own domestic consumption."],
            ["This pandemic has shown us clearly the vulgarity of our healthcare system. Highest costs in the world, yet not enough nurses or doctors. Many millions uninsured, while insurance company profits soar. The struggle continues. Healthcare is a human right. Medicare for all."]]

interface = gr.Interface.load("huggingface/m-newhauser/distilbert-political-tweets",
            description=description,
            examples=examples,
            inputs=gr.inputs.Textbox(lines=6, placeholder="Paste a tweet here!"), # the input text box
            outputs="label",
            allow_flagging=False,
            interpretation="shap", 
            num_shap=5
)

interface.launch(
    # auth=("admin", "dachshunds") # adding authentication provides only the public URL
)