Spaces:
Sleeping
Sleeping
Update frontend.py
Browse files- 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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
|