Skip to content

Commit

Permalink
Merge pull request #6 from SonyCSLParis/interface
Browse files Browse the repository at this point in the history
added running time + sample config
  • Loading branch information
InesBlin authored Oct 13, 2022
2 parents 9f423d3 + 0ed8102 commit 4ccd2c9
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 3 deletions.
10 changes: 8 additions & 2 deletions app/app.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
""" Main streamlit app """
import os
from datetime import datetime
import streamlit as st
import streamlit.components.v1 as components

Expand Down Expand Up @@ -35,7 +36,7 @@
with st.form("common_params_form"):
dataset = st.selectbox(
EVENT_INPUT['select_dataset'],
tuple(VARIABLES_DATASET.keys()), key="dataset")
tuple(sorted(tuple(VARIABLES_DATASET.keys()))), key="dataset")

start_node = st.text_input(
EVENT_INPUT['select_start_node'],
Expand Down Expand Up @@ -134,13 +135,16 @@
run_search = st.button(GRAPH_SEARCH['btn_run_search'])
if run_search:
with st.spinner("Running the search"):
for config, folder in [(config_1, folder_1), (config_2, folder_2)]:
for config, folder, nb in [(config_1, folder_1, "1"), (config_2, folder_2, "2")]:
start_time = datetime.now()
if (not os.path.exists(folder)) or \
(f"subgraph-{st.session_state['iterations']}.html" \
not in os.listdir(folder)):
if not os.path.exists(folder):
os.makedirs(folder)
run_search_save_info(config, folder)
end_time = datetime.now()
init_var([(f"time_exp_{nb}", end_time - start_time)])
st.session_state.experiments_run = True


Expand All @@ -163,11 +167,13 @@
# Overall results
with col1_table_res:
st.write(RES_COMPARISON['filter_1'])
st.write(RES_COMPARISON["time_exp"].format(st.session_state["time_exp_1"]))
write_params("1")
st.dataframe(data_1["path_expanded"])

with col2_table_res:
st.write(RES_COMPARISON['filter_2'])
st.write(RES_COMPARISON["time_exp"].format(st.session_state["time_exp_2"]))
write_params("2")
st.dataframe(data_2["path_expanded"])

Expand Down
3 changes: 2 additions & 1 deletion app/content.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@
RES_COMPARISON = {
'headline': "### Comparing the two set of parameters",
'filter_1': "#### Set of filters - 1",
'filter_2': "#### Set of filters - 2"
'filter_2': "#### Set of filters - 2",
'time_exp': "Took {} to run."
}

RES_ITERATION = {
Expand Down
45 changes: 45 additions & 0 deletions sample-data/French_Revolution_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"rdf_type": {
"event": "http://dbpedia.org/ontology/Event"
},
"predicate_filter": ["http://dbpedia.org/ontology/wikiPageWikiLink",
"http://dbpedia.org/ontology/wikiPageRedirects",
"http://dbpedia.org/ontology/wikiPageDisambiguates",
"http://www.w3.org/2000/01/rdf-schema#seeAlso",
"http://xmlns.com/foaf/0.1/depiction",
"http://xmlns.com/foaf/0.1/isPrimaryTopicOf",
"http://dbpedia.org/ontology/thumbnail",
"http://dbpedia.org/ontology/wikiPageExternalLink",
"http://dbpedia.org/ontology/wikiPageID",
"http://dbpedia.org/ontology/wikiPageLength",
"http://dbpedia.org/ontology/wikiPageRevisionID",
"http://dbpedia.org/property/wikiPageUsesTemplate",
"http://www.w3.org/2002/07/owl#sameAs",
"http://www.w3.org/ns/prov#wasDerivedFrom",
"http://dbpedia.org/ontology/wikiPageWikiLinkText",
"http://dbpedia.org/ontology/wikiPageOutDegree",
"http://dbpedia.org/ontology/abstract",
"http://www.w3.org/2000/01/rdf-schema#comment",
"http://www.w3.org/2000/01/rdf-schema#label"],
"start": "http://dbpedia.org/resource/French_Revolution",
"start_date": "1789-05-05",
"end_date": "1799-12-31",
"iterations": 3,
"type_ranking": "pred_object_freq",
"type_interface": "hdt",
"gold_standard": "./sample-data/French_Revolution_gs_events.csv",
"referents": "./sample-data/French_Revolution_referents.json",
"type_metrics": ["precision", "recall", "f1"],
"ordering": {
"domain_range": 1
},
"filtering": {
"what": 1,
"where": 1,
"when": 1,
"who": 1
},
"name_exp": "french_revolution",
"dataset_type": "dbpedia",
"dataset_path": "dbpedia-snapshot-2021-09"
}

0 comments on commit 4ccd2c9

Please sign in to comment.