Spaces:
Running
Running
add theme
Browse files
app.py
CHANGED
@@ -19,7 +19,6 @@ baseline_rankers_dict = {}
|
|
19 |
baseline_ranker_options = []
|
20 |
run_ids = []
|
21 |
finder_options = []
|
22 |
-
finder_labels = {"All": "All Source Finders"}
|
23 |
previous_run_id = 1
|
24 |
|
25 |
run_id_dropdown = None
|
@@ -28,7 +27,7 @@ run_id_dropdown = None
|
|
28 |
|
29 |
# Initialize data in a single async function
|
30 |
async def initialize_data():
|
31 |
-
global questions, source_finders, questions_dict, source_finders_dict, question_options, finder_options,
|
32 |
|
33 |
questions = await get_questions()
|
34 |
source_finders = await get_source_finders()
|
@@ -44,11 +43,9 @@ async def initialize_data():
|
|
44 |
# Create formatted options for dropdowns
|
45 |
question_options = [q['text'] for q in questions]
|
46 |
finder_options = [s["name"] for s in source_finders]
|
47 |
-
finder_labels = {str(f["id"]): f["name"] for f in source_finders}
|
48 |
baseline_ranker_options = [b["name"] for b in baseline_rankers]
|
49 |
|
50 |
|
51 |
-
|
52 |
def update_sources_list(question_option, source_finder_id, run_id: str, baseline_ranker_id: str, evt: gr.EventData = None):
|
53 |
global previous_run_id
|
54 |
if evt:
|
@@ -65,7 +62,7 @@ def update_sources_list(question_option, source_finder_id, run_id: str, baseline
|
|
65 |
async def update_sources_list_async(question_option, source_finder_name, run_id:str, baseline_ranker_name: str):
|
66 |
if not question_option:
|
67 |
return gr.skip(), gr.skip(), gr.skip(), "No question selected"
|
68 |
-
|
69 |
# Extract question ID from selection
|
70 |
question_id = questions_dict.get(question_option)
|
71 |
|
@@ -114,7 +111,7 @@ async def update_sources_list_async(question_option, source_finder_name, run_id:
|
|
114 |
async def main():
|
115 |
global run_id_dropdown
|
116 |
await initialize_data()
|
117 |
-
with gr.Blocks(title="Source Runs Explorer") as app:
|
118 |
gr.Markdown("# Source Runs Explorer")
|
119 |
|
120 |
with gr.Row():
|
@@ -223,4 +220,5 @@ async def main():
|
|
223 |
|
224 |
|
225 |
if __name__ == "__main__":
|
|
|
226 |
asyncio.run(main())
|
|
|
19 |
baseline_ranker_options = []
|
20 |
run_ids = []
|
21 |
finder_options = []
|
|
|
22 |
previous_run_id = 1
|
23 |
|
24 |
run_id_dropdown = None
|
|
|
27 |
|
28 |
# Initialize data in a single async function
|
29 |
async def initialize_data():
|
30 |
+
global questions, source_finders, questions_dict, source_finders_dict, question_options, finder_options, baseline_rankers_dict, source_finders_dict, baseline_ranker_options
|
31 |
|
32 |
questions = await get_questions()
|
33 |
source_finders = await get_source_finders()
|
|
|
43 |
# Create formatted options for dropdowns
|
44 |
question_options = [q['text'] for q in questions]
|
45 |
finder_options = [s["name"] for s in source_finders]
|
|
|
46 |
baseline_ranker_options = [b["name"] for b in baseline_rankers]
|
47 |
|
48 |
|
|
|
49 |
def update_sources_list(question_option, source_finder_id, run_id: str, baseline_ranker_id: str, evt: gr.EventData = None):
|
50 |
global previous_run_id
|
51 |
if evt:
|
|
|
62 |
async def update_sources_list_async(question_option, source_finder_name, run_id:str, baseline_ranker_name: str):
|
63 |
if not question_option:
|
64 |
return gr.skip(), gr.skip(), gr.skip(), "No question selected"
|
65 |
+
logger.info("processing update")
|
66 |
# Extract question ID from selection
|
67 |
question_id = questions_dict.get(question_option)
|
68 |
|
|
|
111 |
async def main():
|
112 |
global run_id_dropdown
|
113 |
await initialize_data()
|
114 |
+
with gr.Blocks(title="Source Runs Explorer", theme=gr.themes.Citrus()) as app:
|
115 |
gr.Markdown("# Source Runs Explorer")
|
116 |
|
117 |
with gr.Row():
|
|
|
220 |
|
221 |
|
222 |
if __name__ == "__main__":
|
223 |
+
logging.basicConfig(level=logging.INFO)
|
224 |
asyncio.run(main())
|