EE21 commited on
Commit
8e106db
1 Parent(s): 71f1303

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -7,13 +7,13 @@ from keyword_extraction import extract_keywords
7
  from keyphrase_extraction import extract_sentences_with_obligations
8
  #from blanc import BlancHelp
9
 
 
10
  # Load in ToS
11
  dataset = load_dataset("EE21/ToS-Summaries")
12
 
13
  # Extract titles or identifiers for the ToS
14
  tos_titles = ["None"] + [f"Document {i}" for i in range(len(dataset['train']))]
15
 
16
-
17
  # Set page to wide mode
18
  st.set_page_config(layout="wide")
19
 
@@ -52,7 +52,7 @@ def main():
52
  uploaded_file = st.file_uploader("Upload a PDF", type="pdf")
53
 
54
  # Dropdown for selecting the document
55
- tos_selection_index = st.selectbox("Select a Terms of Service Document", range(len(tos_titles)), format_func=lambda x: tos_titles[x])
56
 
57
  if st.button("Summarize"):
58
  if uploaded_file and user_input and tos_selection_index:
@@ -64,7 +64,7 @@ def main():
64
  st.write("PDF uploaded successfully.")
65
  elif user_input:
66
  file_content = user_input
67
- elif tos_selection != "None":
68
  tos_selection_index = tos_titles.index(tos_selection) - 1 # Adjust for the added 'None' option
69
  file_content = dataset['train'][tos_selection_index]['plain_text']
70
  else:
 
7
  from keyphrase_extraction import extract_sentences_with_obligations
8
  #from blanc import BlancHelp
9
 
10
+
11
  # Load in ToS
12
  dataset = load_dataset("EE21/ToS-Summaries")
13
 
14
  # Extract titles or identifiers for the ToS
15
  tos_titles = ["None"] + [f"Document {i}" for i in range(len(dataset['train']))]
16
 
 
17
  # Set page to wide mode
18
  st.set_page_config(layout="wide")
19
 
 
52
  uploaded_file = st.file_uploader("Upload a PDF", type="pdf")
53
 
54
  # Dropdown for selecting the document
55
+ tos_selection_index = st.selectbox("Select a Terms of Service Document", range(len(tos_titles)), format_func=lambda x: tos_titles[x])
56
 
57
  if st.button("Summarize"):
58
  if uploaded_file and user_input and tos_selection_index:
 
64
  st.write("PDF uploaded successfully.")
65
  elif user_input:
66
  file_content = user_input
67
+ elif tos_selection_index != "None":
68
  tos_selection_index = tos_titles.index(tos_selection) - 1 # Adjust for the added 'None' option
69
  file_content = dataset['train'][tos_selection_index]['plain_text']
70
  else: