Leo Liu commited on
Commit
f24a63b
Β·
verified Β·
1 Parent(s): ce0d2f1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -18
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
- # Custom CSS styling
91
  st.markdown("""
92
  <style>
93
  .header {
94
- background: linear-gradient(45deg, #FF9A6C, #FF6B6B);
95
- border-radius: 15px;
96
- padding: 2rem;
97
  text-align: center;
98
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
99
- margin-bottom: 2rem;
 
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 style='color: white;'>Evaluate the service quality with simple uploading!</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
- progress_bar = st.progress(0)
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
- progress_bar.progress(100)
 
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: πŸ“§ **abc@hellotoby.com**")
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()