khaerens commited on
Commit
5696d33
1 Parent(s): dd243a1
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -20,12 +20,12 @@ wiki_state_variables = {
20
  'wiki_text' : [],
21
  'nodes':[],
22
  "topics":[],
23
- "html":""
24
  }
25
 
26
  free_text_state_variables = {
27
  'has_run_free':False,
28
- "html":""
29
 
30
  }
31
 
@@ -53,7 +53,7 @@ def wiki_generate_graph():
53
  nodes = rebel.generate_knowledge_graph(texts, st.session_state["GRAPH_FILENAME"])
54
  HtmlFile = open(st.session_state["GRAPH_FILENAME"], 'r', encoding='utf-8')
55
  source_code = HtmlFile.read()
56
- st.session_state["html"] = source_code
57
  os.remove(st.session_state["GRAPH_FILENAME"])
58
  print("gen_graph", nodes)
59
  for n in nodes:
@@ -110,7 +110,7 @@ def free_text_generate():
110
  rebel.generate_knowledge_graph([text], st.session_state["GRAPH_FILENAME"])
111
  HtmlFile = open(st.session_state["GRAPH_FILENAME"], 'r', encoding='utf-8')
112
  source_code = HtmlFile.read()
113
- st.session_state["html"] = source_code
114
  os.remove(st.session_state["GRAPH_FILENAME"])
115
  st.session_state['has_run_free'] = True
116
 
@@ -180,7 +180,7 @@ def show_wiki_hub_page():
180
 
181
  if st.session_state['has_run_wiki']:
182
 
183
- components.html(st.session_state["html"], width=720, height=600)
184
  num_buttons = len(st.session_state["nodes"])
185
  num_cols = num_buttons if 0 < num_buttons < 7 else 7
186
  columns = st.columns([1] * num_cols + [1])
@@ -206,7 +206,7 @@ def show_free_text_hub_page():
206
 
207
  if st.session_state['has_run_free']:
208
  print(st.session_state)
209
- components.html(st.session_state["html"], width=720, height=600)
210
 
211
  if st.session_state['input_method'] == "wikipedia":
212
  wiki_init_state_variables()
 
20
  'wiki_text' : [],
21
  'nodes':[],
22
  "topics":[],
23
+ "html_wiki":""
24
  }
25
 
26
  free_text_state_variables = {
27
  'has_run_free':False,
28
+ "html_free":""
29
 
30
  }
31
 
 
53
  nodes = rebel.generate_knowledge_graph(texts, st.session_state["GRAPH_FILENAME"])
54
  HtmlFile = open(st.session_state["GRAPH_FILENAME"], 'r', encoding='utf-8')
55
  source_code = HtmlFile.read()
56
+ st.session_state["html_wiki"] = source_code
57
  os.remove(st.session_state["GRAPH_FILENAME"])
58
  print("gen_graph", nodes)
59
  for n in nodes:
 
110
  rebel.generate_knowledge_graph([text], st.session_state["GRAPH_FILENAME"])
111
  HtmlFile = open(st.session_state["GRAPH_FILENAME"], 'r', encoding='utf-8')
112
  source_code = HtmlFile.read()
113
+ st.session_state["html_free"] = source_code
114
  os.remove(st.session_state["GRAPH_FILENAME"])
115
  st.session_state['has_run_free'] = True
116
 
 
180
 
181
  if st.session_state['has_run_wiki']:
182
 
183
+ components.html(st.session_state["html_wiki"], width=720, height=600)
184
  num_buttons = len(st.session_state["nodes"])
185
  num_cols = num_buttons if 0 < num_buttons < 7 else 7
186
  columns = st.columns([1] * num_cols + [1])
 
206
 
207
  if st.session_state['has_run_free']:
208
  print(st.session_state)
209
+ components.html(st.session_state["html_free"], width=720, height=600)
210
 
211
  if st.session_state['input_method'] == "wikipedia":
212
  wiki_init_state_variables()