Skill Tracer
Skills › Scientific Agent Skills › hugging-science › using-spaces.md

using-spaces.md

112 lines · skills/hugging-science/references/using-spaces.md at 5f2bc03

Open on GitHub
1# Using Hugging Science Spaces
2
3A Space can be Gradio, Docker or static content. An organization listing does not
4mean every entry is an inference service or has a public API. Check `sdk`, runtime
5and the actual application before passing inputs. Public Spaces can sleep, fail,
6queue or require paid compute; they are not an availability or cost guarantee.
7

Using Hugging Science Spaces

A Space can be Gradio, Docker or static content. An organization listing does not mean every entry is an inference service or has a public API. Check sdk, runtime and the actual application before passing inputs. Public Spaces can sleep, fail, queue or require paid compute; they are not an availability or cost guarantee.

Raw lines 1 to 7
8## Inspect before calling
9
10```bash
11uv pip install 'gradio-client==2.7.1' 'huggingface-hub<2' python-dotenv
12```
14Metadata-only discovery (no inference or uploads):
16```python
17from huggingface_hub import HfApi
18api = HfApi(token=False)
19for space in api.list_spaces(author="hugging-science", limit=100):
20 print(space.id, space.sdk)
21info = api.space_info("hugging-science/BoltzGen_Demo")
22print(info.sdk, info.runtime.stage)
23```
25`list_spaces` is a paginated iterator; `limit` caps the number yielded, not a promise
26of a complete organization inventory. Names are case sensitive: the reviewed
27BoltzGen demo is `hugging-science/BoltzGen_Demo`, not `boltzgen-demo`.
29When the selected Gradio runtime is available, inspect its schema:
31```python
32import os
33from dotenv import load_dotenv
34load_dotenv()
35from gradio_client import Client
37# token=False suppresses implicit credentials for a public app.
38# Use token=os.environ["HF_TOKEN"] only when authentication is needed and authorized.
39client = Client("hugging-science/BoltzGen_Demo", token=False,
40 analytics_enabled=False, httpx_kwargs={"timeout": 30})
41schema = client.view_api(return_format="dict")
42print(schema)
43```
45Gradio Client 2.7.1 uses `token=` (older examples may say `hf_token=`).
46`token=None` allows the locally saved/HF_TOKEN credential. Access authentication
47and `oauth_token=` are distinct: the latter lets an app act on your behalf and is
48only sent to endpoints declaring OAuth requirements. Do not provide an OAuth token
49for ordinary inference. Review the actual app/operator and data-transfer scope
50regardless of its organization. Follow existing user authorization; clarify only
51when the proposed upload or execution is outside that scope.

Inspect before calling

uv pip install 'gradio-client==2.7.1' 'huggingface-hub<2' python-dotenv

Metadata-only discovery (no inference or uploads):

from huggingface_hub import HfApi
api = HfApi(token=False)
for space in api.list_spaces(author="hugging-science", limit=100):
    print(space.id, space.sdk)
info = api.space_info("hugging-science/BoltzGen_Demo")
print(info.sdk, info.runtime.stage)

list_spaces is a paginated iterator; limit caps the number yielded, not a promise of a complete organization inventory. Names are case sensitive: the reviewed BoltzGen demo is hugging-science/BoltzGen_Demo, not boltzgen-demo.

When the selected Gradio runtime is available, inspect its schema:

import os
from dotenv import load_dotenv
load_dotenv()
from gradio_client import Client

# token=False suppresses implicit credentials for a public app.
# Use token=os.environ["HF_TOKEN"] only when authentication is needed and authorized.
client = Client("hugging-science/BoltzGen_Demo", token=False,
                analytics_enabled=False, httpx_kwargs={"timeout": 30})
schema = client.view_api(return_format="dict")
print(schema)

Gradio Client 2.7.1 uses token= (older examples may say hf_token=). token=None allows the locally saved/HF_TOKEN credential. Access authentication and oauth_token= are distinct: the latter lets an app act on your behalf and is only sent to endpoints declaring OAuth requirements. Do not provide an OAuth token for ordinary inference. Review the actual app/operator and data-transfer scope regardless of its organization. Follow existing user authorization; clarify only when the proposed upload or execution is outside that scope.

Raw lines 8 to 52
53## BoltzGen: source contract, runtime currently unverified
55On 2026-10-01 the public Space repository resolved with runtime `PAUSED`, while `/config` and
56`/gradio_api/info` returned HTTP 503. Thus `Client` discovery and end-to-end
57inference were **not** validated. Do not substitute an invented `/generate` API.
59The [reviewed app source](https://huggingface.co/spaces/hugging-science/BoltzGen_Demo/blob/main/app.py)
60registers `run_boltzgen` with five inputs, in order:
621. Design YAML file.
632. Target PDB/CIF file referenced by that YAML.
643. Protocol: `protein-anything`, `peptide-anything` or `nanobody-anything`.
654. Number of candidate designs.
665. Budget: final diversified design count, at most the number of candidates.
68Budget is not an LLM token allowance. The run returns a **status string**; it does
69not directly return sequences or coordinates. Separate download actions exist.
70Their exact generated API names and return arity must be checked in `view_api()`
71when the runtime recovers. The reviewed source has shared `/tmp/output` paths and
72a download function returning two values for a one-output event; file isolation
73and download behavior need verification before relying on a public run.
75After the live schema is confirmed, an illustrative call pattern is:
77```python
78from gradio_client import handle_file
80# Set this from the live schema; it is deliberately not a guessed endpoint.
81api_name = confirmed_run_api_name
82status = client.predict(
83 handle_file("design.yaml"), handle_file("target.pdb"),
84 "protein-anything", 2, 1, api_name=api_name,
86print(status)
87```
89`handle_file` marks an input for upload. A local filename alone may be interpreted
90as text. It does not upload until the client call is submitted. Returned Gradio file
91components normally download to the client's local output directory; status text
92containing a server path is not itself a downloaded file. Use the actual output
93schema and verify artifacts belong to the current job.

BoltzGen: source contract, runtime currently unverified

On 2026-10-01 the public Space repository resolved with runtime PAUSED, while /config and /gradio_api/info returned HTTP 503. Thus Client discovery and end-to-end inference were not validated. Do not substitute an invented /generate API.

The reviewed app source registers run_boltzgen with five inputs, in order:

  1. Design YAML file.
  2. Target PDB/CIF file referenced by that YAML.
  3. Protocol: protein-anything, peptide-anything or nanobody-anything.
  4. Number of candidate designs.
  5. Budget: final diversified design count, at most the number of candidates.

Budget is not an LLM token allowance. The run returns a status string; it does not directly return sequences or coordinates. Separate download actions exist. Their exact generated API names and return arity must be checked in view_api() when the runtime recovers. The reviewed source has shared /tmp/output paths and a download function returning two values for a one-output event; file isolation and download behavior need verification before relying on a public run.

After the live schema is confirmed, an illustrative call pattern is:

from gradio_client import handle_file

# Set this from the live schema; it is deliberately not a guessed endpoint.
api_name = confirmed_run_api_name
status = client.predict(
    handle_file("design.yaml"), handle_file("target.pdb"),
    "protein-anything", 2, 1, api_name=api_name,
)
print(status)

handle_file marks an input for upload. A local filename alone may be interpreted as text. It does not upload until the client call is submitted. Returned Gradio file components normally download to the client's local output directory; status text containing a server path is not itself a downloaded file. Use the actual output schema and verify artifacts belong to the current job.

Raw lines 53 to 94
95## Other reviewed organization entries
97| Space | What the public metadata/source establishes |
98|---|---|
99| `hugging-science/anatomy-of-boltzgen` | Static educational site; no Gradio inference API |
100| `hugging-science/dataset-quest` | Gradio dataset discovery/submission app; submission is a write |
101| `hugging-science/science-release-map` | Docker visualization; old `science-release-heatmap` ID did not resolve publicly |
102| `hugging-science/HuggingMod` | Gradio moderation tooling, not scientific inference |
104Do not retry a submitted design job blindly after a timeout: inspect its job/status
105first to avoid duplicate compute. Duplicating a Space provisions separate resources
106and may incur charges; it is a deployment action, not a read-only workaround. When
107no runtime/API is available, report that limitation and use the author's local
108workflow if it is feasible and within the task.
110Sources: [Gradio Client 2.7.1](https://github.com/gradio-app/gradio/blob/gradio_client%402.7.1/client/python/gradio_client/client.py),
111[file handling](https://github.com/gradio-app/gradio/blob/gradio_client%402.7.1/client/python/gradio_client/utils.py),
112[HfApi Space methods](https://huggingface.co/docs/huggingface_hub/package_reference/hf_api).

Other reviewed organization entries

SpaceWhat the public metadata/source establishes
hugging-science/anatomy-of-boltzgenStatic educational site; no Gradio inference API
hugging-science/dataset-questGradio dataset discovery/submission app; submission is a write
hugging-science/science-release-mapDocker visualization; old science-release-heatmap ID did not resolve publicly
hugging-science/HuggingModGradio moderation tooling, not scientific inference

Do not retry a submitted design job blindly after a timeout: inspect its job/status first to avoid duplicate compute. Duplicating a Space provisions separate resources and may incur charges; it is a deployment action, not a read-only workaround. When no runtime/API is available, report that limitation and use the author's local workflow if it is feasible and within the task.

Sources: Gradio Client 2.7.1, file handling, HfApi Space methods.

Raw lines 95 to 112