Instructions to use Jvachier/punctuation-casing-en-7m with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Keras
How to use Jvachier/punctuation-casing-en-7m with Keras:
# !pip install -U keras tensorflow huggingface_hub # Keras needs TensorFlow installed to read "hf://" paths, so the tensorflow backend is selected here; # "jax" and "torch" also work for computation once TensorFlow is installed. import os os.environ["KERAS_BACKEND"] = "tensorflow" import keras model = keras.saving.load_model("hf://Jvachier/punctuation-casing-en-7m") - Notebooks
- Google Colab
- Kaggle
Download example.py from Jvachier/punctuation-casing-en-7m: direct link, hf CLI and curl.
- Browser
- Download file 926 Bytes
-
https://huggingface.co/Jvachier/punctuation-casing-en-7m/resolve/main/example.py
- Command line
-
hf download hf://Jvachier/punctuation-casing-en-7m/example.py
-
curl -L -o example.py https://huggingface.co/Jvachier/punctuation-casing-en-7m/resolve/main/example.py
926 Bytes
| """Restore punctuation and casing with punctuation-casing-en-7m. | |
| pip install "keras>=3.6" jax tokenizers huggingface_hub | |
| python example.py # downloads the model from the Hub | |
| python example.py path/to/local/folder # or uses a local copy | |
| """ | |
| import sys | |
| from pathlib import Path | |
| from huggingface_hub import snapshot_download | |
| REPO_ID = "Jvachier/punctuation-casing-en-7m" | |
| folder = Path(sys.argv[1]) if len(sys.argv) > 1 else Path(snapshot_download(REPO_ID)) | |
| sys.path.insert(0, str(folder)) # modeling.py ships with the model | |
| import modeling # noqa: E402 | |
| cleaner = modeling.Cleaner.from_folder(folder) | |
| text = ( | |
| "okay so lets start with the budget we spent about twenty percent more than planned on " | |
| "marketing in march john do you know why that happened i think it was the new campaign on " | |
| "instagram we should check the numbers with the finance team next week" | |
| ) | |
| print(cleaner(text)) | |