Spaces:
Runtime error
Runtime error
File size: 925 Bytes
a1b658b 6781451 3a93e63 a1b658b 3a93e63 a1b658b ad3c02f a1b658b ad3c02f a1b658b |
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 32 33 |
import gradio as gr
import numpy as np
from PIL import Image
import requests
import hopsworks
import joblib
project = hopsworks.login(project='liangc40')
#fs = project.get_feature_store()
mr = project.get_model_registry()
model = mr.get_model("sentimental_analysis_model", version=1)
#model_dir = model.download()
#model = joblib.load(model_dir + "/sentimental_analysis_model.pkl")
def analyse(text):
label = model(text)
return label
with gr.Blocks() as demo:
gr.Markdown("<h1><center>Sentiment Analysis with Fine-tuned BERT Model")
inputs_text=gr.Textbox(placeholder='Type your text for which you want know the sentiment', label='Text')
text_button = gr.Button('Analyse Sentiment')
output_text_sentiment = gr.Textbox(placeholder='Sentiment of the text.', label='Sentiment')
text_button.click(analyse, inputs = inputs_text, outputs = output_text_sentiment)
demo.launch(debug = True) |