Leo Liu
commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -87,16 +87,17 @@ def rate_quality(text):
|
|
| 87 |
def main():
|
| 88 |
st.set_page_config(page_title="Customer Service Quality Analyzer", page_icon="ποΈ")
|
| 89 |
|
| 90 |
-
#
|
| 91 |
st.markdown("""
|
| 92 |
<style>
|
| 93 |
.header {
|
| 94 |
-
background: linear-gradient(
|
| 95 |
-
border-radius:
|
| 96 |
-
padding:
|
| 97 |
text-align: center;
|
| 98 |
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
| 99 |
-
margin-bottom:
|
|
|
|
| 100 |
}
|
| 101 |
</style>
|
| 102 |
""", unsafe_allow_html=True)
|
|
@@ -104,7 +105,7 @@ def main():
|
|
| 104 |
st.markdown("""
|
| 105 |
<div class="header">
|
| 106 |
<h1 style='margin:0;'>ποΈ Customer Service Quality Analyzer</h1>
|
| 107 |
-
<p
|
| 108 |
</div>
|
| 109 |
""", unsafe_allow_html=True)
|
| 110 |
|
|
@@ -115,26 +116,19 @@ def main():
|
|
| 115 |
with open(temp_audio_path, "wb") as f:
|
| 116 |
f.write(uploaded_file.getbuffer())
|
| 117 |
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
# Step 1: Audio transcription
|
| 121 |
-
with st.spinner('π Step 1: Transcribing audio, please wait...'):
|
| 122 |
transcript = transcribe_audio(temp_audio_path)
|
| 123 |
-
progress_bar.progress(50)
|
| 124 |
-
st.write("**Transcript:**", transcript)
|
| 125 |
-
|
| 126 |
-
# Step 2: Sentiment Analysis
|
| 127 |
-
with st.spinner('π§ββοΈ Step 2: Analyzing sentiment, please wait...'):
|
| 128 |
quality_rating = rate_quality(transcript)
|
| 129 |
-
|
|
|
|
| 130 |
st.write("**Sentiment Analysis Result:**", quality_rating)
|
| 131 |
|
| 132 |
result_text = f"Transcript:\n{transcript}\n\nSentiment Analysis Result: {quality_rating}"
|
| 133 |
st.download_button(label="π₯ Download Analysis Report", data=result_text, file_name="analysis_report.txt")
|
| 134 |
|
| 135 |
-
st.markdown("βIf you encounter any issues, please contact customer support: π§ **
|
| 136 |
|
| 137 |
os.remove(temp_audio_path)
|
| 138 |
|
| 139 |
if __name__ == "__main__":
|
| 140 |
-
main()
|
|
|
|
| 87 |
def main():
|
| 88 |
st.set_page_config(page_title="Customer Service Quality Analyzer", page_icon="ποΈ")
|
| 89 |
|
| 90 |
+
# Business-oriented CSS styling
|
| 91 |
st.markdown("""
|
| 92 |
<style>
|
| 93 |
.header {
|
| 94 |
+
background: linear-gradient(90deg, #4B79A1, #283E51);
|
| 95 |
+
border-radius: 10px;
|
| 96 |
+
padding: 1.5rem;
|
| 97 |
text-align: center;
|
| 98 |
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
| 99 |
+
margin-bottom: 1.5rem;
|
| 100 |
+
color: white;
|
| 101 |
}
|
| 102 |
</style>
|
| 103 |
""", unsafe_allow_html=True)
|
|
|
|
| 105 |
st.markdown("""
|
| 106 |
<div class="header">
|
| 107 |
<h1 style='margin:0;'>ποΈ Customer Service Quality Analyzer</h1>
|
| 108 |
+
<p>Evaluate the service quality with simple uploading!</p>
|
| 109 |
</div>
|
| 110 |
""", unsafe_allow_html=True)
|
| 111 |
|
|
|
|
| 116 |
with open(temp_audio_path, "wb") as f:
|
| 117 |
f.write(uploaded_file.getbuffer())
|
| 118 |
|
| 119 |
+
with st.spinner('π Processing your audio, please wait...'):
|
|
|
|
|
|
|
|
|
|
| 120 |
transcript = transcribe_audio(temp_audio_path)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 121 |
quality_rating = rate_quality(transcript)
|
| 122 |
+
|
| 123 |
+
st.write("**Transcript:**", transcript)
|
| 124 |
st.write("**Sentiment Analysis Result:**", quality_rating)
|
| 125 |
|
| 126 |
result_text = f"Transcript:\n{transcript}\n\nSentiment Analysis Result: {quality_rating}"
|
| 127 |
st.download_button(label="π₯ Download Analysis Report", data=result_text, file_name="analysis_report.txt")
|
| 128 |
|
| 129 |
+
st.markdown("βIf you encounter any issues, please contact customer support: π§ **support@hellotoby.com**")
|
| 130 |
|
| 131 |
os.remove(temp_audio_path)
|
| 132 |
|
| 133 |
if __name__ == "__main__":
|
| 134 |
+
main()
|