Upload fetch_and_process.py
Browse files- fetch_and_process.py +81 -0
fetch_and_process.py
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
import urllib.request, json
|
| 3 |
+
from datetime import datetime, timezone
|
| 4 |
+
|
| 5 |
+
url = 'https://llmsnare-api.mistermorph.com/v1/timelines?limit=96'
|
| 6 |
+
data = json.loads(urllib.request.urlopen(url, timeout=60).read())
|
| 7 |
+
|
| 8 |
+
NAMES = {
|
| 9 |
+
'deepseek_v4_pro': 'DeepSeek V4 Pro',
|
| 10 |
+
'deepseek_v4_flash': 'DeepSeek V4 Flash',
|
| 11 |
+
'claude_opus_4_6': 'Claude Opus 4.6',
|
| 12 |
+
'claude_opus_4_7': 'Claude Opus 4.7',
|
| 13 |
+
'claude_sonnet_4_6': 'Claude Sonnet 4.6',
|
| 14 |
+
'openai_gpt_5_5': 'GPT-5.5',
|
| 15 |
+
'openai_gpt_5_4': 'GPT-5.4',
|
| 16 |
+
'minimax_m_2_7': 'MiniMax M2.7',
|
| 17 |
+
'minimax_m_2_5': 'MiniMax M2.5',
|
| 18 |
+
'glm_5_turbo': 'GLM-5 Turbo',
|
| 19 |
+
'glm_5_1': 'GLM-5.1',
|
| 20 |
+
'grok_4_1_fast_reasoning': 'Grok 4.1 Fast',
|
| 21 |
+
'grok_4_2_reasoning': 'Grok 4.2',
|
| 22 |
+
'gemini_3_5_flash': 'Gemini 3.5 Flash',
|
| 23 |
+
'gemini_3_1_pro_preview': 'Gemini 3.1 Pro',
|
| 24 |
+
'gemini_3_1_flash_lite': 'Gemini 3.1 Flash Lite',
|
| 25 |
+
'gemini_2_5_flash': 'Gemini 2.5 Flash',
|
| 26 |
+
'kimi_k_2_5': 'Kimi K2.5',
|
| 27 |
+
'kimi_k_2_6': 'Kimi K2.6',
|
| 28 |
+
'openrouter_qwen_3_5_27b': 'Qwen 3.5 27B',
|
| 29 |
+
'openrouter_qwen_3_6_plus': 'Qwen 3.6 Plus',
|
| 30 |
+
'openrouter_gemma_4_31b': 'Gemma 4 31B',
|
| 31 |
+
'openrouter_mimo_v2_pro': 'Mimo V2 Pro'
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
rows = []
|
| 35 |
+
for pid, pdata in data.get('profiles', {}).items():
|
| 36 |
+
entries = pdata.get('entries', [])
|
| 37 |
+
name = NAMES.get(pid, pid)
|
| 38 |
+
points = sorted([(e['timestamp'], e['normalized_score'], e.get('raw_score',0), e.get('max_score',0)) for e in entries], key=lambda x: x[0])
|
| 39 |
+
scores = [p[1] for p in points]
|
| 40 |
+
raw = [p[2] for p in points]
|
| 41 |
+
maxs = [p[3] for p in points]
|
| 42 |
+
n = len(scores)
|
| 43 |
+
if n < 4:
|
| 44 |
+
continue
|
| 45 |
+
avg8 = round(sum(scores[-8:]) / 8, 1)
|
| 46 |
+
prev8 = scores[-16:-8] if n >= 16 else scores[:max(1,n-8)]
|
| 47 |
+
avg_prev8 = round(sum(prev8)/len(prev8),1) if prev8 else avg8
|
| 48 |
+
change = round(avg8 - avg_prev8, 1)
|
| 49 |
+
latest = round(scores[-1], 1)
|
| 50 |
+
latest_raw = int(raw[-1])
|
| 51 |
+
latest_max = int(maxs[-1])
|
| 52 |
+
rows.append({'name':name,'avg8':avg8,'change':change,'latest':latest,'raw':latest_raw,'max':latest_max})
|
| 53 |
+
|
| 54 |
+
rows.sort(key=lambda x: -x['avg8'])
|
| 55 |
+
now = datetime.now(timezone.utc).strftime('%Y-%m-%d %H:%M UTC')
|
| 56 |
+
|
| 57 |
+
lines = []
|
| 58 |
+
lines.append('π **LLM Snare Arena ηζ§**')
|
| 59 |
+
lines.append(f'π
{now}')
|
| 60 |
+
lines.append('')
|
| 61 |
+
lines.append('**π₯ Top 5οΌθΏζεεοΌοΌ**')
|
| 62 |
+
for i,r in enumerate(rows[:5],1):
|
| 63 |
+
lines.append(f'{i}. {r["name"]} β {r["avg8"]}')
|
| 64 |
+
lines.append('')
|
| 65 |
+
lines.append('**π ε«εΊ 3οΌ**')
|
| 66 |
+
for r in rows[-3:]:
|
| 67 |
+
lines.append(f'- {r["name"]} β {r["avg8"]}')
|
| 68 |
+
lines.append('')
|
| 69 |
+
lines.append('**π θΏζεεοΌε8 vs εε8οΌοΌ**')
|
| 70 |
+
changes = sorted(rows, key=lambda x: -abs(x['change']))[:6]
|
| 71 |
+
for r in changes:
|
| 72 |
+
arrow = 'β' if r['change']>0 else 'β'
|
| 73 |
+
lines.append(f'- {r["name"]} {arrow} {abs(r["change"])}')
|
| 74 |
+
lines.append('')
|
| 75 |
+
lines.append('**π ζζ°δΈζ¬‘εΎεοΌ**')
|
| 76 |
+
for r in rows:
|
| 77 |
+
icon = 'β
' if r['latest'] >= 50 else 'β'
|
| 78 |
+
lines.append(f'{icon} {r["name"]} β {r["latest"]} ({r["raw"]}/{r["max"]})')
|
| 79 |
+
|
| 80 |
+
result = '\n'.join(lines)
|
| 81 |
+
print(result)
|