xujinheng666 commited on
Commit
c42d4ba
·
verified ·
1 Parent(s): bbdb74d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -16,7 +16,7 @@ def load_models():
16
  st.session_state.translation_tokenizer = AutoTokenizer.from_pretrained("botisan-ai/mt5-translate-yue-zh")
17
  st.session_state.translation_model = AutoModelForSeq2SeqLM.from_pretrained("botisan-ai/mt5-translate-yue-zh")
18
 
19
- st.session_state.rating_pipe = pipeline("text-classification", model="uer/roberta-base-finetuned-jd-binary-chinese")
20
 
21
  def transcribe_audio(audio_path):
22
  pipe = st.session_state.transcription_pipe
@@ -31,8 +31,8 @@ def translate_text(text):
31
 
32
  def rate_quality(text):
33
  result = st.session_state.rating_pipe(text)[0]
34
- label = result["label"].split("(")[0].strip().lower()
35
- label_map = {"negative": "Poor", "neutral": "Average", "positive": "Good"}
36
  return label_map.get(label, "Unknown")
37
 
38
  def main():
 
16
  st.session_state.translation_tokenizer = AutoTokenizer.from_pretrained("botisan-ai/mt5-translate-yue-zh")
17
  st.session_state.translation_model = AutoModelForSeq2SeqLM.from_pretrained("botisan-ai/mt5-translate-yue-zh")
18
 
19
+ st.session_state.rating_pipe = pipeline("text-classification", model="jackietung/bert-base-chinese-finetuned-sentiment")
20
 
21
  def transcribe_audio(audio_path):
22
  pipe = st.session_state.transcription_pipe
 
31
 
32
  def rate_quality(text):
33
  result = st.session_state.rating_pipe(text)[0]
34
+ label = result["label"]
35
+ label_map = {"負面": "Poor", "中性": "Average", "正面": "Good"}
36
  return label_map.get(label, "Unknown")
37
 
38
  def main():