szzzzz commited on
Commit
27402a3
1 Parent(s): 10bb4e7

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -0
app.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from PIL import Image
3
+ from sentiment_classification import SentimentClassifier
4
+
5
+
6
+ model = SentimentClassifier()
7
+ model.load('szzzzz/sentiment_classifier_sentence_level_bert_16m')
8
+
9
+
10
+
11
+ def detect(text):
12
+ return round(model.rank(text),2)
13
+
14
+
15
+ with gr.Blocks() as app:
16
+ gr.Markdown("Sentiment Classification To 5 Stars")
17
+ with gr.Tab("Sentiment Classifier"):
18
+ text_input = gr.Textbox()
19
+ text_output = gr.Slider(minimum=1,maximum=5)
20
+ text_button = gr.Button("SentimentClassifier")
21
+
22
+
23
+ text_button.click(detect, inputs=text_input, outputs=text_output)
24
+
25
+ app.launch(server_name="0.0.0.0")