Stellajin916 commited on
Commit
392d1a7
·
verified ·
1 Parent(s): 602715a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -0
app.py CHANGED
@@ -9,6 +9,27 @@ sentiment_model_name = "uer/roberta-base-finetuned-jd-binary-chinese"
9
  sentiment_tokenizer = AutoTokenizer.from_pretrained(sentiment_model_name)
10
  sentiment_model = AutoModelForSequenceClassification.from_pretrained(sentiment_model_name)
11
  sentiment_model.eval()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
 
13
  # --------- Multi-label Classification Model (Your model) ---------
14
  label_dir = "./result"
 
9
  sentiment_tokenizer = AutoTokenizer.from_pretrained(sentiment_model_name)
10
  sentiment_model = AutoModelForSequenceClassification.from_pretrained(sentiment_model_name)
11
  sentiment_model.eval()
12
+ if not os.path.exists("result"):
13
+ with zipfile.ZipFile("model_output.zip", "r") as zip_ref:
14
+ zip_ref.extractall(".")
15
+
16
+
17
+ # 加载你的多标签分类模型
18
+ label_tokenizer = AutoTokenizer.from_pretrained("result")
19
+ label_model = AutoModelForSequenceClassification.from_pretrained("result", use_safetensors=True)
20
+ label_model.eval()
21
+
22
+ # 多标签类别
23
+ label_map = {
24
+ 0: "Landscape & Culture",
25
+ 1: "Service & Facilities",
26
+ 2: "Experience & Atmosphere",
27
+ 3: "Transportation Accessibility",
28
+ 4: "Interactive Activities",
29
+ 5: "Price & Consumption"
30
+ }
31
+ threshold = 0.5
32
+
33
 
34
  # --------- Multi-label Classification Model (Your model) ---------
35
  label_dir = "./result"