Skip to content

Commit 763e302

Browse files
committed
Update project widgets and examples [ci skip]
1 parent 908f3a4 commit 763e302

File tree

2 files changed

+35
-37
lines changed

2 files changed

+35
-37
lines changed

website/docs/usage/projects.md

Lines changed: 34 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ pipelines.
219219
<!-- TODO: update with better (final) example -->
220220
221221
```yaml
222-
https://github.com/explosion/spacy-boilerplates/blob/master/ner_fashion/project.yml
222+
https://github.com/explosion/projects/tree/v3/tutorials/ner_fashion_brands/project.yml
223223
```
224224
225225
| Section | Description |
@@ -815,8 +815,10 @@ package helps you integrate spaCy visualizations into your Streamlit apps and
815815
quickly spin up demos to explore your pipelines interactively. It includes a
816816
full embedded visualizer, as well as individual components.
817817
818+
<!-- TODO: update once version is stable -->
819+
818820
```bash
819-
$ pip install spacy_streamlit
821+
$ pip install "spacy_streamlit>=1.0.0a0"
820822
```
821823
822824
</div>
@@ -828,22 +830,15 @@ $ pip install spacy_streamlit
828830
Using [`spacy-streamlit`](https://github.com/explosion/spacy-streamlit), your
829831
projects can easily define their own scripts that spin up an interactive
830832
visualizer, using the latest pipeline you trained, or a selection of pipelines
831-
so you can compare their results. The following script starts an
832-
[NER visualizer](/usage/visualizers#ent) and takes two positional command-line
833-
argument you can pass in from your `config.yml`: a comma-separated list of paths
834-
to load the pipelines from and an example text to use as the default text.
833+
so you can compare their results.
835834
836-
<!-- TODO: replace with embed -->
835+
<Project id="integrations/streamlit">
837836
838-
```python
839-
### scripts/visualize.py
840-
import spacy_streamlit
841-
import sys
837+
Get started with spaCy and Streamlit using our project template. It includes a
838+
script to spin up a custom visualizer and commands you can adjust to showcase
839+
and explore your own custom trained pipelines.
842840
843-
DEFAULT_TEXT = sys.argv[2] if len(sys.argv) >= 3 else ""
844-
PIPELINES = [name.strip() for name in sys.argv[1].split(",")]
845-
spacy_streamlit.visualize(PIPELINES, DEFAULT_TEXT, visualizers=["ner"])
846-
```
841+
</Project>
847842
848843
> #### Example usage
849844
>
@@ -860,16 +855,16 @@ commands:
860855
script:
861856
- 'streamlit run ./scripts/visualize.py ./training/model-best "I like Adidas shoes."'
862857
deps:
863-
- 'training/model-best'
858+
- "training/model-best"
864859
```
865860
866-
<Project id="integrations/streamlit">
861+
The following script is called from the `project.yml` and takes two positional
862+
command-line argument: a comma-separated list of paths or packages to load the
863+
pipelines from and an example text to use as the default text.
867864
868-
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus interdum
869-
sodales lectus, ut sodales orci ullamcorper id. Sed condimentum neque ut erat
870-
mattis pretium.
871-
872-
</Project>
865+
```python
866+
https://github.com/explosion/projects/blob/v3/integrations/streamlit/scripts/visualize.py
867+
```
873868
874869
---
875870
@@ -882,9 +877,11 @@ library for serving machine learning models and you can use it in your spaCy
882877
projects to quickly serve up a trained pipeline and make it available behind a
883878
REST API.
884879
885-
```python
886-
# TODO: show an example that addresses some of the main concerns for serving ML (workers etc.)
887-
```
880+
<Project id="integrations/fastapi">
881+
882+
Get started with spaCy and FastAPI using our project template.
883+
884+
</Project>
888885
889886
> #### Example usage
890887
>
@@ -895,23 +892,24 @@ REST API.
895892
<!-- prettier-ignore -->
896893
```yaml
897894
### project.yml
898-
commands:
899-
- name: serve
900-
help: "Serve the trained pipeline with FastAPI"
895+
- name: "serve"
896+
help: "Serve the models via a FastAPI REST API using the given host and port"
901897
script:
902-
- 'python ./scripts/serve.py ./training/model-best'
898+
- "uvicorn scripts.main:app --reload --host 127.0.0.1 --port 5000"
903899
deps:
904-
- 'training/model-best'
900+
- "scripts/main.py"
905901
no_skip: true
906902
```
907903
908-
<Project id="integrations/fastapi">
904+
The script included in the template shows a simple REST API with a `POST`
905+
endpoint that accepts batches of texts and returns batches of predictions, e.g.
906+
named entities found in the documents. Type hints and
907+
[`pydantic`](https://github.com/samuelcolvin/pydantic) are used to define the
908+
expected data types.
909909
910-
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus interdum
911-
sodales lectus, ut sodales orci ullamcorper id. Sed condimentum neque ut erat
912-
mattis pretium.
913-
914-
</Project>
910+
```python
911+
https://github.com/explosion/projects/blob/v3/integrations/fastapi/scripts/main.py
912+
```
915913
916914
---
917915

website/src/widgets/project.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import Link from '../components/link'
66
import { InlineCode } from '../components/code'
77

88
// TODO: move to meta?
9-
const DEFAULT_REPO = 'https://github.com/explosion/projects'
9+
const DEFAULT_REPO = 'https://github.com/explosion/projects/tree/v3'
1010
const COMMAND = 'python -m spacy project clone'
1111

1212
export default function Project({ id, repo, children }) {

0 commit comments

Comments
 (0)