Files
hack/tools/scripts/llm-key-hunter/results/_cache/content/8876841-bit_human-environment-lab.json

1 line
4.1 KiB
JSON
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{"repo": "8876841-bit/human-environment-lab", "files": {"scripts/animate_dmxapi.py": {"1ff3872c77d1921c538c53d7694ba7a213ba8242": {"t": 1785768913.020098, "n": 3681, "h": "bee3c0ef21350e66", "c": "\"\"\"选题01|5镜图生视频——dmxapi Hailuo\"\"\"\nimport os, requests, time, base64\n\nwith open(\"/private/tmp/Human-Environment-Lab/.env\") as f:\n for line in f:\n if \"=\" in line and not line.startswith(\"#\") and line.strip():\n k, v = line.strip().split(\"=\", 1)\n os.environ[k] = v.strip()\n\nKEY = os.getenv(\"DMXAPI_API_KEY\")\nIMG = \"/Users/wqq/Downloads/海洋板案例收集/1/2/\"\nOUT = \"/Users/wqq/Downloads/海洋板案例收集/1/2/animated/\"\nos.makedirs(OUT, exist_ok=True)\nH = {\"Authorization\": f\"Bearer {KEY}\", \"Content-Type\": \"application/json\"}\n\nSHOTS = [\n (\"2026年6月19日 16_21_36.png\", \"Camera pushes in extremely slowly toward five figures on bench. Dust floats in warm afternoon light beam from left window. Five round figures perfectly still — no blinking, no breathing. Wall clock frozen. Only dust moves and camera creeps. Warm melancholy. No sudden movement.\"),\n (\"2026年6月19日 16_21_43.png\", \"Locked-off static camera. Left figure's head tilts very slightly — barely perceptible micro-movement toward right figure. Right figure completely frozen. Dust floats in warm light. Movement so subtle it might be illusion.\"),\n (\"2026年6月19日 16_21_48.png\", \"Camera dollies right very slowly past empty wooden seats. Remaining figures motionless, not looking at empty seats. Dust floats slower. Calendar turned page, clock still 4:10.\"),\n (\"2026年6月19日 16_21_52.png\", \"Completely static shot. Five empty benches. Only movement: curtain corner barely moves from unseen draft. Dust nearly still. Absolute stillness.\"),\n (\"2026年6月19日 16_21_55.png\", \"Camera tilts up slowly from shadow to face. Single figure stands, chest rises with one shallow breath — first breath in series. Curtain corner still barely moves. He is thinking.\"),\n]\n\nprint(\"=== 选题01 Hailuo 图生视频 ===\\n\")\nfor i, (fname, prompt) in enumerate(SHOTS, 1):\n with open(IMG + fname, \"rb\") as f:\n b64 = base64.b64encode(f.read()).decode()\n\n print(f\"[{i}/5] 提交...\")\n r = requests.post(\"https://www.dmxapi.cn/v1/video_generation\", headers=H, json={\n \"model\": \"MiniMax-Hailuo-02\", \"prompt\": prompt,\n \"image\": f\"data:image/png;base64,{b64}\", \"duration\": 6, \"resolution\": \"1080P\"\n }, timeout=60)\n if r.status_code != 200:\n print(f\" ❌ {r.status_code} {r.text[:150]}\\n\"); continue\n\n tid = r.json()[\"task_id\"]\n print(f\" task_id={tid} 轮询...\")\n\n # Poll\n for _ in range(36):\n time.sleep(10)\n pq = requests.get(f\"https://www.dmxapi.cn/v1/query/video_generation?task_id={tid}\", headers={\"Authorization\": f\"Bearer {KEY}\"}, timeout=20)\n if pq.status_code == 200:\n d = pq.json()\n if d.get(\"status\") == \"Success\":\n fid = d[\"file_id\"]\n # Download — needs both file_id and task_id\n dr = requests.get(f\"https://www.dmxapi.cn/v1/files/retrieve?file_id={fid}&task_id={tid}\",\n headers={\"Authorization\": f\"Bearer {KEY}\"}, timeout=20)\n if dr.status_code == 200:\n dl_url = dr.json().get(\"file\", {}).get(\"download_url\", \"\")\n if dl_url:\n vdata = requests.get(dl_url, timeout=60).content\n op = f\"{OUT}shot_{i:02d}.mp4\"\n with open(op, \"wb\") as wf:\n wf.write(vdata)\n print(f\" ✅ {op}\\n\")\n else:\n print(f\" ❌ 无下载链接: {dr.text[:200]}\\n\")\n else:\n print(f\" ✅ 任务完成但下载失败: {dr.status_code}\\n\")\n break\n elif d.get(\"status\") == \"Failed\":\n print(f\" ❌ 失败\\n\"); break\n else:\n print(f\" ⏰ 超时\\n\")\n\nprint(\"完成。\")\n"}}}}