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")