David Pomerenke commited on
Commit
de59e09
·
1 Parent(s): 561eed2

Try URL param -> site mapping

Browse files
Files changed (1) hide show
  1. app.py +16 -2
app.py CHANGED
@@ -570,8 +570,22 @@ css="""
570
  }
571
  """
572
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
573
  # Create the visualization components
574
- with gr.Blocks(title="AI Language Proficiency Benchmark", css=css) as demo:
575
  gr.Markdown("# AI Language Proficiency Benchmark")
576
  gr.Markdown("Comparing language proficiency across different models and languages.")
577
 
@@ -743,7 +757,7 @@ with gr.Blocks(title="AI Language Proficiency Benchmark", css=css) as demo:
743
  )
744
 
745
 
746
- for lang in tqdm(languages[:20], desc="Generating pages"):
747
  with demo.route(lang['language_name'], f"/{lang['bcp_47']}"):
748
  gr.Markdown(f"## {lang['language_name']}")
749
 
 
570
  }
571
  """
572
 
573
+
574
+ shortcut_js = """
575
+ <script>
576
+ const params = new URLSearchParams(window.location.search);
577
+ const lang = params.get("lang");
578
+ console.log(lang);
579
+ if (lang) {
580
+ console.log("redirecting to " + lang);
581
+ window.location.href = "/" + lang;
582
+ }
583
+ </script>
584
+ """
585
+
586
+
587
  # Create the visualization components
588
+ with gr.Blocks(title="AI Language Proficiency Benchmark", css=css, head=shortcut_js) as demo:
589
  gr.Markdown("# AI Language Proficiency Benchmark")
590
  gr.Markdown("Comparing language proficiency across different models and languages.")
591
 
 
757
  )
758
 
759
 
760
+ for lang in tqdm(languages[:5], desc="Generating pages"):
761
  with demo.route(lang['language_name'], f"/{lang['bcp_47']}"):
762
  gr.Markdown(f"## {lang['language_name']}")
763