File size: 1,299 Bytes
ed1eaf5
109e0c4
 
8b6d8ff
ed1eaf5
8b6d8ff
 
ed1eaf5
d8fc4cb
 
c067bfd
8b6d8ff
 
 
2b939bd
71e83ab
f817a07
d966d69
ce74d8a
e3c2dad
 
71e83ab
d966d69
 
e3c2dad
 
 
71e83ab
128fd43
d8fc4cb
8b6d8ff
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
import gradio as gr
from transformers import pipeline

sentiment = pipeline("sentiment-analysis")

def get_sentiment(input_text):
  return sentiment(input_text)

if __name__ == "__main__":
  iface = gr.Interface(
    fn = get_sentiment, 
    inputs = "text", 
    outputs = ['text'],
    title = 'Sentiment Analysis', 
    description = 'Determine how negative or positive a given sentiment is. Input a sentence or two and see what the model "thinks."',
    btn = gr.Button("Run"),
    css="app.css",
    examples=[
        ["better than nothing, I guess... I guess you get what you pay for :("],
        ["This is better than nothing. You get what you pay for!"],
        ["the price reasonable"],
        ["Is this price considered reasonable?"],
        ["This is better than a kick in the face. Guess you can't look a gift horse in the mouth."],
        ["They seem to have a bias as all the people working at the reception look exactly the same."],
        ["All the people working at the reception look exactly the same!"],
        ["this was expected, clean towels and room cleaned every day"],
        ["The top of the window was covered by a dirty blind. It was pretty gross."],
        ["The helpful staff were consistently cheap and comfortable."]
    ]
  )
  iface.launch(inline = False)