mayf commited on
Commit
5ffa6af
·
verified ·
1 Parent(s): fb540ec

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -30,9 +30,14 @@ def load_sentiment_pipeline():
30
  def load_keybert_model():
31
  return KeyBERT(model="all-MiniLM-L6-v2")
32
 
33
- # ─── FLAN-T5 Generation Pipeline ────────────────────────────────────────────
34
  @st.cache_resource
35
  def load_response_pipeline():
 
 
 
 
 
36
  seq_tok = AutoTokenizer.from_pretrained("google/flan-t5-base")
37
  seq_model = AutoModelForSeq2SeqLM.from_pretrained("google/flan-t5-base")
38
  return pipeline(
@@ -106,7 +111,7 @@ def main():
106
  if max_label in ["Positive", "Very Positive"]:
107
  prompt = (
108
  f"You are a friendly customer success representative. The customer said: \"{review}\". "
109
- "Write two sentences to appreciative reply their positive experience."
110
  )
111
  else:
112
  prompt = (
 
30
  def load_keybert_model():
31
  return KeyBERT(model="all-MiniLM-L6-v2")
32
 
33
+ # ─── BlenderBot Response Pipeline ───────────────────────────────────────────
34
  @st.cache_resource
35
  def load_response_pipeline():
36
+ # High-level helper using BlenderBot 400M Distill
37
+ return pipeline(
38
+ "text2text-generation",
39
+ model="facebook/blenderbot-400M-distill"
40
+ ):
41
  seq_tok = AutoTokenizer.from_pretrained("google/flan-t5-base")
42
  seq_model = AutoModelForSeq2SeqLM.from_pretrained("google/flan-t5-base")
43
  return pipeline(
 
111
  if max_label in ["Positive", "Very Positive"]:
112
  prompt = (
113
  f"You are a friendly customer success representative. The customer said: \"{review}\". "
114
+ "Write a warm, appreciative reply celebrating their positive experience."
115
  )
116
  else:
117
  prompt = (