davanstrien HF staff commited on
Commit
195a3cd
1 Parent(s): 842e3d0

chore: Add lru_cache to improve performance of data fetching

Browse files
Files changed (1) hide show
  1. app.py +2 -0
app.py CHANGED
@@ -3,6 +3,7 @@ import httpx
3
  from toolz import groupby
4
  import plotly.express as px
5
  import pandas as pd
 
6
 
7
  choices = sorted(
8
  [
@@ -19,6 +20,7 @@ choices = sorted(
19
  )
20
 
21
 
 
22
  def fetch_data(framework):
23
  r = httpx.get(f"https://huggingface.co/api/datasets?filter={framework}")
24
  data = r.json()
 
3
  from toolz import groupby
4
  import plotly.express as px
5
  import pandas as pd
6
+ from functools import lru_cache
7
 
8
  choices = sorted(
9
  [
 
20
  )
21
 
22
 
23
+ @lru_cache(maxsize=100)
24
  def fetch_data(framework):
25
  r = httpx.get(f"https://huggingface.co/api/datasets?filter={framework}")
26
  data = r.json()