Spaces:
Build error
Build error
docs: replace Space README with usage and storage notes
Browse files- keep the Space title as StockAnalysis and refresh short_description
- remove the old placeholder/offensive README content
- document discovery, cheapest-then-fastest routing, pass criteria, and budget
- document the UI controls, history dropdown, and JSON download
- document HF_TOKEN requirements and that the token is never written to disk
- describe the /data/hf-inference-smoke storage layout
- describe the project layout for app.py, smoke.py, and requirements.txt
README.md
CHANGED
|
@@ -9,7 +9,65 @@ python_version: '3.13'
|
|
| 9 |
app_file: app.py
|
| 10 |
pinned: false
|
| 11 |
license: mit
|
| 12 |
-
short_description:
|
| 13 |
---
|
| 14 |
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
app_file: app.py
|
| 10 |
pinned: false
|
| 11 |
license: mit
|
| 12 |
+
short_description: Smoke-test the 30 most trending chat models.
|
| 13 |
---
|
| 14 |
|
| 15 |
+
# StockAnalysis - HF Inference Smoke Test
|
| 16 |
+
|
| 17 |
+
Smoke-tests the **30 most trending** chat-completion models on Hugging Face
|
| 18 |
+
through [Inference Providers](https://huggingface.co/docs/inference-providers)
|
| 19 |
+
and reports a literal `True` or `False` for each model.
|
| 20 |
+
|
| 21 |
+
## What it does
|
| 22 |
+
|
| 23 |
+
1. **Discovery** - queries the Hub for `conversational` models sorted by
|
| 24 |
+
`trendingScore`, scanning past the requested count so models without a live
|
| 25 |
+
inference provider are skipped.
|
| 26 |
+
2. **Routing** - calls each model through the HF router with `:cheapest`. If the
|
| 27 |
+
request fails, it retries once with `:fastest`.
|
| 28 |
+
3. **Pass criteria** - `True` only when the router returns HTTP 200 with a
|
| 29 |
+
non-empty `choices` array. Anything else is `False` with a recorded error.
|
| 30 |
+
4. **Concurrency** - three models are tested at a time with a 60s timeout each.
|
| 31 |
+
5. **Budget** - each attempt requests at most 8 output tokens, so a 30-model run
|
| 32 |
+
costs well under a cent of Inference Providers credit.
|
| 33 |
+
|
| 34 |
+
## Using the app
|
| 35 |
+
|
| 36 |
+
- Press **Run smoke test** to test the top trending models.
|
| 37 |
+
- Adjust **Models to test** to scan more or fewer models.
|
| 38 |
+
- The table shows rank, model, `True`/`False`, the routing policy that produced
|
| 39 |
+
the passing attempt, latency, and the error for failures.
|
| 40 |
+
- Use **Run history** to reload a previous run.
|
| 41 |
+
- **Download run JSON** exports the currently displayed run.
|
| 42 |
+
|
| 43 |
+
`HF_TOKEN` must be available as a Space secret or environment variable. This is
|
| 44 |
+
a normal read token with Inference Providers access; the app never writes the
|
| 45 |
+
token to disk. Without a token the app shows a clear error and refuses to make
|
| 46 |
+
inference calls.
|
| 47 |
+
|
| 48 |
+
## Storage
|
| 49 |
+
|
| 50 |
+
Run artifacts go to the persistent bucket, not the repository:
|
| 51 |
+
|
| 52 |
+
```text
|
| 53 |
+
/data/hf-inference-smoke/
|
| 54 |
+
βββ latest.json # most recent run (mirror)
|
| 55 |
+
βββ runs/<run_id>.json # one file per run
|
| 56 |
+
βββ models/latest.json # most recent discovery snapshot
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
## Project layout
|
| 60 |
+
|
| 61 |
+
```text
|
| 62 |
+
app.py # Gradio Blocks dashboard
|
| 63 |
+
smoke.py # discovery, routing, runner, persistence
|
| 64 |
+
requirements.txt # pinned dependencies
|
| 65 |
+
```
|
| 66 |
+
|
| 67 |
+
## Notes
|
| 68 |
+
|
| 69 |
+
- Models are ordered by trending score, not downloads.
|
| 70 |
+
- Trending models can lack a live provider; discovery scans further to keep the
|
| 71 |
+
requested count.
|
| 72 |
+
- A `False` result means that model could not produce a valid chat completion
|
| 73 |
+
through either routing policy at the time of the run.
|