khaerens commited on
Commit
65a0b31
·
1 Parent(s): 54eb790
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -79,6 +79,8 @@ def wiki_show_text(page_title):
79
  page = wikipedia.page(title=page_title, auto_suggest=False)
80
  st.session_state['wiki_text'].append(clip_text(page.summary))
81
  st.session_state['topics'].append(page_title.lower())
 
 
82
  except wikipedia.DisambiguationError as e:
83
  with st.spinner(text="Woops, ambigious term, recalculating options..."):
84
  st.session_state['wiki_suggestions'].remove(page_title)
@@ -91,9 +93,13 @@ def wiki_add_text(term):
91
  if len(st.session_state['wiki_text']) > 4:
92
  return
93
  try:
94
- extra_text = clip_text(wikipedia.page(title=term, auto_suggest=False).summary)
 
 
95
  st.session_state['wiki_text'].append(extra_text)
96
  st.session_state['topics'].append(term.lower())
 
 
97
  except wikipedia.DisambiguationError as e:
98
  print(e)
99
  with st.spinner(text="Woops, ambigious term, recalculating options..."):
 
79
  page = wikipedia.page(title=page_title, auto_suggest=False)
80
  st.session_state['wiki_text'].append(clip_text(page.summary))
81
  st.session_state['topics'].append(page_title.lower())
82
+ st.session_state['wiki_suggestions'].remove(page_title)
83
+
84
  except wikipedia.DisambiguationError as e:
85
  with st.spinner(text="Woops, ambigious term, recalculating options..."):
86
  st.session_state['wiki_suggestions'].remove(page_title)
 
93
  if len(st.session_state['wiki_text']) > 4:
94
  return
95
  try:
96
+ page = wikipedia.page(title=term, auto_suggest=False)
97
+ extra_text = clip_text(page.summary)
98
+
99
  st.session_state['wiki_text'].append(extra_text)
100
  st.session_state['topics'].append(term.lower())
101
+ st.session_state['nodes'].remove(term)
102
+
103
  except wikipedia.DisambiguationError as e:
104
  print(e)
105
  with st.spinner(text="Woops, ambigious term, recalculating options..."):