Download fin-mm/code/test.py from GoldenGrapeGentleman1/FinMM-MultiModal-Forecasting: direct link, hf CLI and curl.
- Browser
- Download file 784 Bytes
-
https://huggingface.co/GoldenGrapeGentleman1/FinMM-MultiModal-Forecasting/resolve/main/fin-mm/code/test.py
- Command line
-
hf download hf://GoldenGrapeGentleman1/FinMM-MultiModal-Forecasting/fin-mm/code/test.py
-
curl -L -o test.py https://huggingface.co/GoldenGrapeGentleman1/FinMM-MultiModal-Forecasting/resolve/main/fin-mm/code/test.py
784 Bytes
| from __future__ import annotations | |
| import json | |
| import random | |
| from pathlib import Path | |
| from typing import Dict, Any, List, Optional | |
| import requests | |
| # ================= 基本配置 ================= | |
| NIM_API_KEY = "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" | |
| NIM_ENDPOINT = "https://integrate.api.nvidia.com/v1/chat/completions" | |
| MODEL_NAME = "meta/llama-3.2-90b-vision-instruct" | |
| headers = { | |
| "Authorization": f"Bearer {NIM_API_KEY}", | |
| "Content-Type": "application/json", | |
| } | |
| payload = { | |
| "model": MODEL_NAME, | |
| "messages": [ | |
| {"role": "user", "content": "用一句话介绍一下你自己。"} | |
| ], | |
| "max_tokens": 64, | |
| } | |
| r = requests.post(NIM_ENDPOINT, headers=headers, json=payload, timeout=30) | |
| print(r.status_code) | |
| print(r.text[:500]) |