Commit
β’
9ce3fb9
1
Parent(s):
bbf93bc
format links
Browse files
app.py
CHANGED
@@ -6,7 +6,9 @@ import gradio as gr
|
|
6 |
from huggingface_hub import get_collection
|
7 |
from cytoolz import groupby
|
8 |
from collections import defaultdict
|
|
|
9 |
|
|
|
10 |
is_macos = platform.system() == "Darwin"
|
11 |
LIMIT = None
|
12 |
|
@@ -20,8 +22,10 @@ def get_models():
|
|
20 |
def get_datasets():
|
21 |
return list(iter(list_datasets(full=True, limit=LIMIT)))
|
22 |
|
23 |
-
|
24 |
-
|
|
|
|
|
25 |
|
26 |
def check_for_arxiv_id(model):
|
27 |
return [tag for tag in model.tags if "arxiv" in tag] if model.tags else False
|
@@ -94,11 +98,14 @@ def get_papers_for_collection(collection_slug: str):
|
|
94 |
dataset_papers.append(arxiv_id)
|
95 |
if collection_models is not None:
|
96 |
for model in collection.get("models", []):
|
97 |
-
if
|
98 |
data = {
|
99 |
"model": model.item_id,
|
100 |
-
"
|
101 |
-
"
|
|
|
|
|
|
|
102 |
}
|
103 |
model_papers.append(data)
|
104 |
return {"datasets": dataset_papers, "models": model_papers}
|
@@ -106,4 +113,4 @@ def get_papers_for_collection(collection_slug: str):
|
|
106 |
|
107 |
url = "HF-IA-archiving/models-to-archive-65006a7fdadb8c628f33aac9"
|
108 |
|
109 |
-
gr.Interface(get_papers_for_collection,"text", "json").launch()
|
|
|
6 |
from huggingface_hub import get_collection
|
7 |
from cytoolz import groupby
|
8 |
from collections import defaultdict
|
9 |
+
import os
|
10 |
|
11 |
+
os.environ["HF_HUB_ENABLE_HF_TRANSFER"] = "1"
|
12 |
is_macos = platform.system() == "Darwin"
|
13 |
LIMIT = None
|
14 |
|
|
|
22 |
def get_datasets():
|
23 |
return list(iter(list_datasets(full=True, limit=LIMIT)))
|
24 |
|
25 |
+
|
26 |
+
get_models() # warm up the cache
|
27 |
+
get_datasets() # warm up the cache
|
28 |
+
|
29 |
|
30 |
def check_for_arxiv_id(model):
|
31 |
return [tag for tag in model.tags if "arxiv" in tag] if model.tags else False
|
|
|
98 |
dataset_papers.append(arxiv_id)
|
99 |
if collection_models is not None:
|
100 |
for model in collection.get("models", []):
|
101 |
+
if arxiv_ids := models_to_arxiv_id.get(model.item_id, None):
|
102 |
data = {
|
103 |
"model": model.item_id,
|
104 |
+
"arxiv_ids": arxiv_ids,
|
105 |
+
"hub_paper_links": [
|
106 |
+
f"https://huggingface.co/papers/{arxiv_id}"
|
107 |
+
for arxiv_id in arxiv_ids
|
108 |
+
],
|
109 |
}
|
110 |
model_papers.append(data)
|
111 |
return {"datasets": dataset_papers, "models": model_papers}
|
|
|
113 |
|
114 |
url = "HF-IA-archiving/models-to-archive-65006a7fdadb8c628f33aac9"
|
115 |
|
116 |
+
gr.Interface(get_papers_for_collection, "text", "json").launch()
|