Use FastAPI to serve your spaCy models and host modern REST APIs. To start the server, you can run spacy project run start. To explore the REST API interactively, navigate to http://127.0.0.1:5000/docs in your browser. See the examples for how to query the API using Python or JavaScript.
The project.yml defines the data assets required by the
project, as well as the available commands and workflows. For details, see the
Weasel documentation.
The following commands are defined by the project. They
can be executed using weasel run [name].
Commands are only re-run if their inputs have changed.
| Command | Description |
|---|---|
download |
Download models |
serve |
Serve the models via a FastAPI REST API using the given host and port |
The following workflows are defined by the project. They
can be executed using weasel run [name]
and will run the specified commands in order. Commands are only re-run if their
inputs have changed.
| Workflow | Steps |
|---|---|
start |
download → serve |
The following assets are defined by the project. They can
be fetched by running weasel assets
in the project directory.
| File | Source | Description |
|---|---|---|
assets/data.jsonl |
URL | Selected sentences from the CMU Movie Summary Corpus used for testing |
The /examples directory includes examples of how to send requests
to your API. The following examples are available:
| File | Language |
|---|---|
Python_Test-REST-API.ipynb |
Python |
Javascript_Test-REST-API.html |
JavaScript (Vanilla) |
React_Test-REST-API.html |
JavaScript (React) |