Created
August 26, 2025 01:12
-
-
Save mb00g/c083a519e5a35e500bf69001883f3361 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import sys | |
import requests | |
import re | |
from datetime import datetime, timedelta | |
from rich.console import Console | |
from rich.table import Table | |
console = Console() | |
if len(sys.argv) < 2: | |
console.print(f"[bold red]Usage:[/bold red] {sys.argv[0]} <tournament_id>") | |
sys.exit(1) | |
tournament_id = sys.argv[1] | |
url = f"https://huggingface.co/api/models?author=rayonlabs&search={tournament_id}" | |
resp = requests.get(url) | |
resp.raise_for_status() | |
models = resp.json() | |
pattern = re.compile(r"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}") | |
uuid_latest_date = {} | |
offset_wib = timedelta(hours=7) | |
for m in models: | |
match = pattern.search(m["modelId"]) | |
if match: | |
uuid = match.group(0) | |
created_at = m.get("createdAt", "") | |
try: | |
dt_utc = datetime.fromisoformat(created_at.replace("Z", "+00:00")) | |
dt_wib = dt_utc + offset_wib | |
except Exception: | |
continue | |
if uuid not in uuid_latest_date or dt_wib > uuid_latest_date[uuid]: | |
uuid_latest_date[uuid] = dt_wib | |
# Urutkan dari terlama → terbaru | |
sorted_items = sorted(uuid_latest_date.items(), key=lambda x: x[1]) | |
# Buat tabel | |
table = Table(title=f"Tournament: [bold cyan]{tournament_id}[/bold cyan]") | |
table.add_column("Tanggal (WIB)", justify="center", style="yellow", no_wrap=True) | |
table.add_column("Task Link", style="cyan") | |
for uuid, dt in sorted_items: | |
tanggal_str = dt.strftime("%d/%m/%y %H:%M:%S") | |
link = f"http://gradients.io/app/research/task/{uuid}" | |
table.add_row(tanggal_str, link) | |
console.print(table) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment