Spaces:
Runtime error
Runtime error
Commit
·
4c9274b
1
Parent(s):
6a3f4fd
use http2
Browse files- app.py +4 -5
- requirements.in +1 -1
- requirements.txt +7 -1
app.py
CHANGED
|
@@ -1,10 +1,8 @@
|
|
| 1 |
from typing import Any, List
|
| 2 |
import gradio as gr
|
| 3 |
from toolz import concat
|
| 4 |
-
import httpx
|
| 5 |
import plotly.express as px
|
| 6 |
import polars as pl
|
| 7 |
-
from pathlib import Path
|
| 8 |
from datasets import load_dataset
|
| 9 |
from cachetools import TTLCache, cached
|
| 10 |
from datetime import datetime, timedelta
|
|
@@ -16,7 +14,7 @@ from toolz import frequencies
|
|
| 16 |
from dotenv import load_dotenv
|
| 17 |
from typing import List, Any
|
| 18 |
from toolz import concat
|
| 19 |
-
import
|
| 20 |
from tqdm.auto import tqdm
|
| 21 |
|
| 22 |
|
|
@@ -30,15 +28,16 @@ assert user
|
|
| 30 |
|
| 31 |
headers = {"user-agent": user_agent, "authorization": f"Bearer {token}"}
|
| 32 |
|
|
|
|
|
|
|
| 33 |
|
| 34 |
def get_hub_community_activity(user: str) -> List[Any]:
|
| 35 |
with tqdm() as pbar:
|
| 36 |
all_data = []
|
| 37 |
i = 1
|
| 38 |
while True:
|
| 39 |
-
r =
|
| 40 |
f"https://huggingface.co/api/recent-activity?limit=100&type=discussion&skip={i}&user={user}",
|
| 41 |
-
headers=headers,
|
| 42 |
)
|
| 43 |
activity = r.json()["recentActivity"]
|
| 44 |
if not activity:
|
|
|
|
| 1 |
from typing import Any, List
|
| 2 |
import gradio as gr
|
| 3 |
from toolz import concat
|
|
|
|
| 4 |
import plotly.express as px
|
| 5 |
import polars as pl
|
|
|
|
| 6 |
from datasets import load_dataset
|
| 7 |
from cachetools import TTLCache, cached
|
| 8 |
from datetime import datetime, timedelta
|
|
|
|
| 14 |
from dotenv import load_dotenv
|
| 15 |
from typing import List, Any
|
| 16 |
from toolz import concat
|
| 17 |
+
from httpx import Client
|
| 18 |
from tqdm.auto import tqdm
|
| 19 |
|
| 20 |
|
|
|
|
| 28 |
|
| 29 |
headers = {"user-agent": user_agent, "authorization": f"Bearer {token}"}
|
| 30 |
|
| 31 |
+
client = Client(headers=headers,http2=True)
|
| 32 |
+
|
| 33 |
|
| 34 |
def get_hub_community_activity(user: str) -> List[Any]:
|
| 35 |
with tqdm() as pbar:
|
| 36 |
all_data = []
|
| 37 |
i = 1
|
| 38 |
while True:
|
| 39 |
+
r = client.get(
|
| 40 |
f"https://huggingface.co/api/recent-activity?limit=100&type=discussion&skip={i}&user={user}",
|
|
|
|
| 41 |
)
|
| 42 |
activity = r.json()["recentActivity"]
|
| 43 |
if not activity:
|
requirements.in
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
cachetools
|
| 2 |
datasets
|
| 3 |
gradio
|
| 4 |
-
httpx
|
| 5 |
plotly
|
| 6 |
polars
|
| 7 |
pyarrow
|
|
|
|
| 1 |
cachetools
|
| 2 |
datasets
|
| 3 |
gradio
|
| 4 |
+
httpx[http2]
|
| 5 |
plotly
|
| 6 |
polars
|
| 7 |
pyarrow
|
requirements.txt
CHANGED
|
@@ -72,9 +72,13 @@ h11==0.14.0
|
|
| 72 |
# via
|
| 73 |
# httpcore
|
| 74 |
# uvicorn
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
httpcore==0.16.3
|
| 76 |
# via httpx
|
| 77 |
-
httpx==0.23.3
|
| 78 |
# via
|
| 79 |
# -r requirements.in
|
| 80 |
# gradio
|
|
@@ -82,6 +86,8 @@ huggingface-hub==0.13.3
|
|
| 82 |
# via
|
| 83 |
# datasets
|
| 84 |
# gradio
|
|
|
|
|
|
|
| 85 |
idna==3.4
|
| 86 |
# via
|
| 87 |
# anyio
|
|
|
|
| 72 |
# via
|
| 73 |
# httpcore
|
| 74 |
# uvicorn
|
| 75 |
+
h2==4.1.0
|
| 76 |
+
# via httpx
|
| 77 |
+
hpack==4.0.0
|
| 78 |
+
# via h2
|
| 79 |
httpcore==0.16.3
|
| 80 |
# via httpx
|
| 81 |
+
httpx[http2]==0.23.3
|
| 82 |
# via
|
| 83 |
# -r requirements.in
|
| 84 |
# gradio
|
|
|
|
| 86 |
# via
|
| 87 |
# datasets
|
| 88 |
# gradio
|
| 89 |
+
hyperframe==6.0.1
|
| 90 |
+
# via h2
|
| 91 |
idna==3.4
|
| 92 |
# via
|
| 93 |
# anyio
|