File size: 635 Bytes
27402a3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import gradio as gr
from PIL import Image
from sentiment_classification import SentimentClassifier


model = SentimentClassifier()
model.load('szzzzz/sentiment_classifier_sentence_level_bert_16m')



def detect(text):
    return round(model.rank(text),2)


with gr.Blocks() as app:
    gr.Markdown("Sentiment Classification To 5 Stars")
    with gr.Tab("Sentiment Classifier"):
        text_input = gr.Textbox()
        text_output = gr.Slider(minimum=1,maximum=5)
        text_button = gr.Button("SentimentClassifier") 
    

    text_button.click(detect, inputs=text_input, outputs=text_output)
    
app.launch(server_name="0.0.0.0")