davanstrien HF Staff commited on
Commit
83e8286
·
1 Parent(s): 10fbaa6

up concurrency

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -17,6 +17,7 @@ from huggingface_hub import (
17
  model_info,
18
  )
19
  from huggingface_hub.utils import EntryNotFoundError, disable_progress_bars
 
20
 
21
  disable_progress_bars()
22
 
@@ -52,8 +53,11 @@ def _get_engagement_stats(hub_id):
52
 
53
  def _try_load_model_card(hub_id):
54
  try:
55
- card_text = ModelCard.load(hub_id, token=token).text
 
56
  length = len(card_text)
 
 
57
  except EntryNotFoundError:
58
  card_text = None
59
  length = None
@@ -264,7 +268,7 @@ SCORES = generate_task_scores_dict()
264
  cache = Cache("/data/")
265
 
266
 
267
- @cache.memoize(expire=60 * 60 * 24) # expires after 24 hours
268
  def _basic_check(hub_id):
269
  try:
270
  data = ModelMetadata.from_hub(hub_id)
 
17
  model_info,
18
  )
19
  from huggingface_hub.utils import EntryNotFoundError, disable_progress_bars
20
+ import httpx
21
 
22
  disable_progress_bars()
23
 
 
53
 
54
  def _try_load_model_card(hub_id):
55
  try:
56
+ url = hf_hub_url(repo_id=hub_id, filename="README.md")
57
+ card_text = httpx.get(url).text
58
  length = len(card_text)
59
+ # card_text = ModelCard.load(hub_id, token=token).text
60
+ # length = len(card_text)
61
  except EntryNotFoundError:
62
  card_text = None
63
  length = None
 
268
  cache = Cache("/data/")
269
 
270
 
271
+ @cache.memoize(expire=60 * 60 * 24 *3 ) # expires after 3 days
272
  def _basic_check(hub_id):
273
  try:
274
  data = ModelMetadata.from_hub(hub_id)