Spaces:
Running on Zero
Running on Zero
Download backend/methods.py from cmuchancel/patent2sysml: direct link, hf CLI and curl.
- Browser
- Download file 796 Bytes
-
https://huggingface.co/spaces/cmuchancel/patent2sysml/resolve/main/backend/methods.py
- Command line
-
hf download hf://spaces/cmuchancel/patent2sysml/backend/methods.py
-
curl -L -o methods.py https://huggingface.co/spaces/cmuchancel/patent2sysml/resolve/main/backend/methods.py
796 Bytes
| """Processing methods plug into one streaming backend contract.""" | |
| from dataclasses import dataclass | |
| from typing import Callable, Iterator | |
| # status, final SJS (or None), final SJS path (or None), research archive (or None) | |
| RunEvents = Iterator[tuple[str, dict | None, str | None, str | None]] | |
| class Method: | |
| name: str | |
| label: str | |
| available: bool | |
| requires_login: bool | |
| run: Callable[..., RunEvents] | |
| def get_method(name: str) -> Method: | |
| # Lazy imports keep the UI and NLP tooling independent of agent dependencies. | |
| if name == "agents": | |
| from agentic.adapter import METHOD | |
| elif name == "nlp": | |
| from fine_tuned_nlp.adapter import METHOD | |
| else: | |
| raise ValueError(f"Unknown processing method: {name}") | |
| return METHOD | |