EE21 commited on
Commit
af8a888
1 Parent(s): bdfa8da

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -7
app.py CHANGED
@@ -124,7 +124,7 @@ def main():
124
  st.write(st.session_state.summary)
125
 
126
  # Generate and display word cloud
127
- wordcloud = WordCloud(width=800, height=400, background_color='white').generate(st.session_state.summary)
128
  # Convert to PIL Image
129
  image = wordcloud.to_image()
130
  # Convert PIL Image to bytes
@@ -142,12 +142,19 @@ def main():
142
  rouge = Rouge()
143
  scores = rouge.get_scores(st.session_state.summary, reference_summary)
144
 
145
- # Display ROUGE scores in a box
146
- with st.container():
147
- st.write("ROUGE Scores:")
148
- st.write(f"ROUGE-1: {scores[0]['rouge-1']['f']:.4f}")
149
- st.write(f"ROUGE-2: {scores[0]['rouge-2']['f']:.4f}")
150
- st.write(f"ROUGE-L: {scores[0]['rouge-l']['f']:.4f}")
 
 
 
 
 
 
 
151
 
152
  if __name__ == "__main__":
153
  main()
 
124
  st.write(st.session_state.summary)
125
 
126
  # Generate and display word cloud
127
+ wordcloud = WordCloud(width=800, height=400, background_color='white', max_words=20).generate(st.session_state.summary)
128
  # Convert to PIL Image
129
  image = wordcloud.to_image()
130
  # Convert PIL Image to bytes
 
142
  rouge = Rouge()
143
  scores = rouge.get_scores(st.session_state.summary, reference_summary)
144
 
145
+
146
+ # Using st.markdown with HTML and inline CSS to create a box around the content
147
+ st.markdown(
148
+ """
149
+ <div style="border: 2px solid #f0f2f6; border-radius: 5px; padding: 10px;">
150
+ <h4 style="color: #2678bf;">ROUGE Scores:</h4>
151
+ <p>ROUGE-1: {rouge_1:.4f}</p>
152
+ <p>ROUGE-2: {rouge_2:.4f}</p>
153
+ <p>ROUGE-L: {rouge_l:.4f}</p>
154
+ </div>
155
+ """.format(rouge_1=scores[0]['rouge-1']['f'], rouge_2=scores[0]['rouge-2']['f'], rouge_l=scores[0]['rouge-l']['f']),
156
+ unsafe_allow_html=True
157
+ )
158
 
159
  if __name__ == "__main__":
160
  main()