qisan commited on
Commit
230b305
1 Parent(s): 70cb3f7

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -12
app.py CHANGED
@@ -1,25 +1,22 @@
1
- from model import DepressionClassifier
2
-
3
  import gradio as gr
4
  import numpy as np
5
- #from PIL import Image
6
- #import requests
7
 
8
  import hopsworks
9
  import joblib
10
- import torch
11
 
12
- project = hopsworks.login(project='liangc40')
13
  #fs = project.get_feature_store()
14
 
15
- mr = project.get_model_registry()
16
- model = mr.get_model("sentimental_analysis_model", version=3)
17
- model_dir = model.download()
18
- model = joblib.load(model_dir + "/sentimental_analysis_model.pkl")
19
- #model = torch.load(model_dir + "/sentimental_analysis_model.pkl", map_location=torch.device('cpu'))
20
 
21
  def analyse(text):
22
- label = model(text)
23
  return label
24
 
25
  with gr.Blocks() as demo:
 
 
 
1
  import gradio as gr
2
  import numpy as np
3
+ from transformers import pipeline
 
4
 
5
  import hopsworks
6
  import joblib
7
+ pipe = pipeline(model="liangc40/sentimental_analysis")
8
 
9
+ #project = hopsworks.login(project='liangc40')
10
  #fs = project.get_feature_store()
11
 
12
+
13
+ #mr = project.get_model_registry()
14
+ #model = mr.get_model("sentimental_analysis_model", version=1)
15
+ #model_dir = model.download()
16
+ #model = joblib.load(model_dir + "/sentimental_analysis_model.pkl")
17
 
18
  def analyse(text):
19
+ label = pipe(text)
20
  return label
21
 
22
  with gr.Blocks() as demo: