Spaces:
Sleeping
Sleeping
Add application file
Browse files
app.py
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
class UI:
|
5 |
+
def __init__(self, model):
|
6 |
+
self.model = pipeline("sentiment-analysis", model="lyrisha/bert-finetuned-imdb-sentiment")
|
7 |
+
|
8 |
+
def launch(self):
|
9 |
+
demo = gr.Interface(
|
10 |
+
fn=self.model,
|
11 |
+
inputs="textbox",
|
12 |
+
outputs="text",
|
13 |
+
title="Check the mood of the sentence",
|
14 |
+
description="The model was trained on 'imdb' dataset to classify sentences as 'positive' or 'negative' attitude.",
|
15 |
+
examples=[["Great news! My reality check just bounced."],
|
16 |
+
["I'm not arguing, I'm just explaining why I'm right."],
|
17 |
+
["I love deadlines, especially the whooshing sound they make as they fly by."],
|
18 |
+
["Life is like a box of chocolates. It's full of nuts."]]
|
19 |
+
)
|
20 |
+
return demo.launch()
|
21 |
+
|
22 |
+
UI().launch()
|