File size: 1,153 Bytes
b4ed758
ad4ff4d
b4ed758
f75c1a1
 
189e8cf
 
91942a5
 
b4ed758
87d4a7d
6bba9d4
 
 
ab05d7a
ef74ad0
91942a5
e9e7e7a
91942a5
 
ef74ad0
91942a5
 
ef74ad0
1dd8f74
ef74ad0
 
 
 
 
 
 
 
 
 
 
91942a5
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import gradio as gr
from transformers import AutoTokenizer, AutoModelForSequenceClassification, pipeline

tokenizer = AutoTokenizer.from_pretrained("Jerimee/autotrain-dontknowwhatImdoing-980432459")
model = AutoModelForSequenceClassification.from_pretrained("Jerimee/autotrain-dontknowwhatImdoing-980432459")

# I don't know what Im doing
#sentiment = pipeline("text-classification", model=model, tokenizer=tokenizer)
classifier = pipeline("sentiment-analysis", model=model, tokenizer=tokenizer)

#outputs = model( **kwargs )
#inputs = "text", 
#outputs = ['text'],


def get_sentiment(input_text):
  return classifier(input_text)


iface = gr.Interface(
    fn = get_sentiment, 
    inputs = "text", 
    outputs = ['text'],
    title = 'Silly Name', 
    description = 'Enter a name. Thing tells you if the name is a silly goblin name, or a respectable human name. For the moment it actually seems to work.',
    btn = gr.Button("Run"),
    css="app.css",
    examples=[
        ["Jerimee"],
        ["Blastnock"],
        ["Mary"],
        ["Hwan"],
        ["Amir"],
        ["Darnell"],
        ["Clubrubble"]
    ]
)
iface.launch() #inline = False