EE21 commited on
Commit
0eb61e5
1 Parent(s): 8e46a2f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -117,8 +117,8 @@ def main():
117
  if 'summary' in st.session_state:
118
  st.write(st.session_state.summary)
119
 
120
- # Check if a reference summary is available
121
- if tos_selection_index is not None and 'summary' in dataset['train'][tos_selection_index]:
122
  # Fetch the reference summary
123
  reference_summary = dataset['train'][tos_selection_index]['summary']
124
 
@@ -126,12 +126,12 @@ def main():
126
  rouge = Rouge()
127
  scores = rouge.get_scores(st.session_state.summary, reference_summary)
128
 
129
- # Display ROUGE scores in a box
130
  with st.container():
131
  st.write("ROUGE Scores:")
132
- st.write(f"ROUGE-1: {scores[0]['rouge-1']['f']:.4f}", unsafe_allow_html=True)
133
- st.write(f"ROUGE-2: {scores[0]['rouge-2']['f']:.4f}", unsafe_allow_html=True)
134
- st.write(f"ROUGE-L: {scores[0]['rouge-l']['f']:.4f}", unsafe_allow_html=True)
135
 
136
  if __name__ == "__main__":
137
  main()
 
117
  if 'summary' in st.session_state:
118
  st.write(st.session_state.summary)
119
 
120
+ # Check if no PDF or text input is provided and a ToS document is selected
121
+ if not uploaded_file and not user_input and tos_selection_index is not None and 'summary' in dataset['train'][tos_selection_index]:
122
  # Fetch the reference summary
123
  reference_summary = dataset['train'][tos_selection_index]['summary']
124
 
 
126
  rouge = Rouge()
127
  scores = rouge.get_scores(st.session_state.summary, reference_summary)
128
 
129
+ # Display ROUGE scores in a box
130
  with st.container():
131
  st.write("ROUGE Scores:")
132
+ st.write(f"ROUGE-1: {scores[0]['rouge-1']['f']:.4f}")
133
+ st.write(f"ROUGE-2: {scores[0]['rouge-2']['f']:.4f}")
134
+ st.write(f"ROUGE-L: {scores[0]['rouge-l']['f']:.4f}")
135
 
136
  if __name__ == "__main__":
137
  main()