Hasitha16 commited on
Commit
68804d2
Β·
verified Β·
1 Parent(s): 36cce4f

Update frontend.py

Browse files
Files changed (1) hide show
  1. frontend.py +26 -1
frontend.py CHANGED
@@ -151,7 +151,32 @@ with tab1:
151
  st.download_button("⬇️ Download Audio", audio.read(), "summary.mp3")
152
 
153
  st.markdown("### πŸ” Ask a Follow-Up")
154
- sample_questions = ["What made the user upset?", "Any feature complaints?", "How urgent is this?"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
155
  selected_q = st.selectbox("πŸ’‘ Suggested Questions", ["Type your own..."] + sample_questions)
156
  custom_q = selected_q if selected_q != "Type your own..." else st.text_input("πŸ” Follow-up Question")
157
 
 
151
  st.download_button("⬇️ Download Audio", audio.read(), "summary.mp3")
152
 
153
  st.markdown("### πŸ” Ask a Follow-Up")
154
+
155
+ # πŸ’‘ Smarter Follow-Up Suggestion Logic
156
+ sentiment = data["sentiment"]["label"].lower()
157
+ churn = data.get("churn_risk", "")
158
+ pain = data.get("pain_points", [])
159
+
160
+ if sentiment == "positive" and churn == "Low Risk":
161
+ sample_questions = [
162
+ "What features impressed the user?",
163
+ "Would they recommend the product?",
164
+ "What delighted the customer most?"
165
+ ]
166
+ elif sentiment == "negative" or churn == "High Risk" or pain:
167
+ sample_questions = [
168
+ "What made the user upset?",
169
+ "Any feature complaints?",
170
+ "Is this user likely to churn?"
171
+ ]
172
+ else:
173
+ sample_questions = [
174
+ "What are the key takeaways?",
175
+ "How can this review guide product changes?",
176
+ "Is there any concern raised?"
177
+ ]
178
+
179
+
180
  selected_q = st.selectbox("πŸ’‘ Suggested Questions", ["Type your own..."] + sample_questions)
181
  custom_q = selected_q if selected_q != "Type your own..." else st.text_input("πŸ” Follow-up Question")
182