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))