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
File size: 926 Bytes
26ff59a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | """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))
|