TedYeh
commited on
Commit
·
0fecaab
1
Parent(s):
abbaadb
add requirements file
Browse files- app.py +2 -2
- requirements.txt +184 -0
app.py
CHANGED
|
@@ -4,8 +4,8 @@ tokenizer = AutoTokenizer.from_pretrained("CodeTed/traditional_CSC_t5")
|
|
| 4 |
model = T5ForConditionalGeneration.from_pretrained("CodeTed/traditional_CSC_t5")
|
| 5 |
|
| 6 |
|
| 7 |
-
def cged_correction(sentence = '
|
| 8 |
-
input_ids = tokenizer(sentence, return_tensors="pt").input_ids
|
| 9 |
outputs = model.generate(input_ids, max_length=256)
|
| 10 |
edited_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 11 |
return edited_text
|
|
|
|
| 4 |
model = T5ForConditionalGeneration.from_pretrained("CodeTed/traditional_CSC_t5")
|
| 5 |
|
| 6 |
|
| 7 |
+
def cged_correction(sentence = '為了降低少子化,政府可以堆動獎勵生育的政策。'):
|
| 8 |
+
input_ids = tokenizer('糾正句子裡的錯字: ' + sentence, return_tensors="pt").input_ids
|
| 9 |
outputs = model.generate(input_ids, max_length=256)
|
| 10 |
edited_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 11 |
return edited_text
|
requirements.txt
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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12.2
|
| 15 |
+
blinker==1.6.2
|
| 16 |
+
blis==0.7.10
|
| 17 |
+
cachetools==5.3.1
|
| 18 |
+
catalogue==1.0.2
|
| 19 |
+
certifi==2023.7.22
|
| 20 |
+
charset-normalizer==3.2.0
|
| 21 |
+
click==8.1.7
|
| 22 |
+
cmake==3.27.2
|
| 23 |
+
confection==0.1.1
|
| 24 |
+
contourpy==1.1.0
|
| 25 |
+
cpm-kernels==1.0.11
|
| 26 |
+
cycler==0.11.0
|
| 27 |
+
cymem==2.0.7
|
| 28 |
+
datasets==2.14.4
|
| 29 |
+
dill==0.3.7
|
| 30 |
+
docker-pycreds==0.4.0
|
| 31 |
+
en-core-web-sm @ https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.6.0/en_core_web_sm-3.6.0-py3-none-any.whl#sha256=83276fc78a70045627144786b52e1f2728ad5e29e5e43916ec37ea9c26a11212
|
| 32 |
+
errant==2.3.3
|
| 33 |
+
exceptiongroup==1.1.3
|
| 34 |
+
fastapi==0.101.1
|
| 35 |
+
ffmpy==0.3.1
|
| 36 |
+
filelock==3.12.2
|
| 37 |
+
Flask==2.3.3
|
| 38 |
+
fonttools==4.42.1
|
| 39 |
+
frozenlist==1.4.0
|
| 40 |
+
fsspec==2023.6.0
|
| 41 |
+
gensim==4.3.1
|
| 42 |
+
gitdb==4.0.10
|
| 43 |
+
GitPython==3.1.32
|
| 44 |
+
google-auth==2.22.0
|
| 45 |
+
google-auth-oauthlib==1.0.0
|
| 46 |
+
gradio==3.40.1
|
| 47 |
+
gradio_client==0.4.0
|
| 48 |
+
grpcio==1.57.0
|
| 49 |
+
h11==0.14.0
|
| 50 |
+
httpcore==0.17.3
|
| 51 |
+
httpx==0.24.1
|
| 52 |
+
huggingface-hub==0.16.4
|
| 53 |
+
idna==3.4
|
| 54 |
+
importlib-metadata==6.8.0
|
| 55 |
+
importlib-resources==6.0.1
|
| 56 |
+
itsdangerous==2.1.2
|
| 57 |
+
jieba==0.42.1
|
| 58 |
+
Jinja2==3.1.2
|
| 59 |
+
joblib==1.3.2
|
| 60 |
+
jsonschema==4.19.0
|
| 61 |
+
jsonschema-specifications==2023.7.1
|
| 62 |
+
kiwisolver==1.4.4
|
| 63 |
+
langcodes==3.3.0
|
| 64 |
+
latex2mathml==3.75.2
|
| 65 |
+
linkify-it-py==2.0.2
|
| 66 |
+
lit==16.0.6
|
| 67 |
+
loguru==0.7.0
|
| 68 |
+
Markdown==3.4.4
|
| 69 |
+
markdown-it-py==2.2.0
|
| 70 |
+
MarkupSafe==2.1.3
|
| 71 |
+
matplotlib==3.7.2
|
| 72 |
+
mdit-py-plugins==0.3.3
|
| 73 |
+
mdtex2html==1.2.0
|
| 74 |
+
mdurl==0.1.2
|
| 75 |
+
mpmath==1.3.0
|
| 76 |
+
multidict==6.0.4
|
| 77 |
+
multiprocess==0.70.15
|
| 78 |
+
murmurhash==1.0.9
|
| 79 |
+
networkx==3.1
|
| 80 |
+
nltk==3.8.1
|
| 81 |
+
numpy==1.24.4
|
| 82 |
+
nvidia-cublas-cu11==11.10.3.66
|
| 83 |
+
nvidia-cuda-cupti-cu11==11.7.101
|
| 84 |
+
nvidia-cuda-nvrtc-cu11==11.7.99
|
| 85 |
+
nvidia-cuda-runtime-cu11==11.7.99
|
| 86 |
+
nvidia-cudnn-cu11==8.5.0.96
|
| 87 |
+
nvidia-cufft-cu11==10.9.0.58
|
| 88 |
+
nvidia-curand-cu11==10.2.10.91
|
| 89 |
+
nvidia-cusolver-cu11==11.4.0.1
|
| 90 |
+
nvidia-cusparse-cu11==11.7.4.91
|
| 91 |
+
nvidia-nccl-cu11==2.14.3
|
| 92 |
+
nvidia-nvtx-cu11==11.7.91
|
| 93 |
+
oauthlib==3.2.2
|
| 94 |
+
OpenCC==1.1.6
|
| 95 |
+
orjson==3.9.5
|
| 96 |
+
packaging==23.1
|
| 97 |
+
pandas==2.0.3
|
| 98 |
+
pathtools==0.1.2
|
| 99 |
+
pathy==0.10.2
|
| 100 |
+
peft==0.4.0
|
| 101 |
+
Pillow==9.5.0
|
| 102 |
+
pkg_resources==0.0.0
|
| 103 |
+
pkgutil_resolve_name==1.3.10
|
| 104 |
+
plac==1.1.3
|
| 105 |
+
preshed==3.0.8
|
| 106 |
+
protobuf==3.20.3
|
| 107 |
+
psutil==5.9.5
|
| 108 |
+
pyarrow==12.0.1
|
| 109 |
+
pyasn1==0.5.0
|
| 110 |
+
pyasn1-modules==0.3.0
|
| 111 |
+
pydantic==2.2.1
|
| 112 |
+
pydantic_core==2.6.1
|
| 113 |
+
pydeck==0.8.0
|
| 114 |
+
pydub==0.25.1
|
| 115 |
+
Pygments==2.16.1
|
| 116 |
+
Pympler==1.0.1
|
| 117 |
+
pyparsing==3.0.9
|
| 118 |
+
python-dateutil==2.8.2
|
| 119 |
+
python-multipart==0.0.6
|
| 120 |
+
pytz==2023.3
|
| 121 |
+
pytz-deprecation-shim==0.1.0.post0
|
| 122 |
+
PyYAML==6.0.1
|
| 123 |
+
rapidfuzz==3.2.0
|
| 124 |
+
referencing==0.30.2
|
| 125 |
+
regex==2023.8.8
|
| 126 |
+
requests==2.31.0
|
| 127 |
+
requests-oauthlib==1.3.1
|
| 128 |
+
rich==13.5.2
|
| 129 |
+
rouge==1.0.1
|
| 130 |
+
rpds-py==0.9.2
|
| 131 |
+
rsa==4.9
|
| 132 |
+
sacremoses==0.0.53
|
| 133 |
+
safetensors==0.3.2
|
| 134 |
+
scikit-learn==1.3.0
|
| 135 |
+
scipy==1.10.1
|
| 136 |
+
semantic-version==2.10.0
|
| 137 |
+
sentencepiece==0.1.99
|
| 138 |
+
sentry-sdk==1.29.2
|
| 139 |
+
setproctitle==1.3.2
|
| 140 |
+
setuptools-rust==1.6.0
|
| 141 |
+
six==1.16.0
|
| 142 |
+
smart-open==6.3.0
|
| 143 |
+
smmap==5.0.0
|
| 144 |
+
sniffio==1.3.0
|
| 145 |
+
soupsieve==2.4.1
|
| 146 |
+
spacy==2.3.9
|
| 147 |
+
spacy-legacy==3.0.12
|
| 148 |
+
spacy-loggers==1.0.4
|
| 149 |
+
srsly==1.0.7
|
| 150 |
+
sse-starlette==1.6.5
|
| 151 |
+
starlette==0.27.0
|
| 152 |
+
streamlit==1.25.0
|
| 153 |
+
sympy==1.12
|
| 154 |
+
tenacity==8.2.3
|
| 155 |
+
tensorboard==2.14.0
|
| 156 |
+
tensorboard-data-server==0.7.1
|
| 157 |
+
text2vec==1.2.2
|
| 158 |
+
textgen==1.0.1
|
| 159 |
+
thinc==7.4.6
|
| 160 |
+
threadpoolctl==3.2.0
|
| 161 |
+
tokenizers==0.13.3
|
| 162 |
+
toml==0.10.2
|
| 163 |
+
toolz==0.12.0
|
| 164 |
+
torch==2.0.1
|
| 165 |
+
tornado==6.3.3
|
| 166 |
+
tqdm==4.66.1
|
| 167 |
+
transformers==4.30.2
|
| 168 |
+
triton==2.0.0
|
| 169 |
+
typer==0.9.0
|
| 170 |
+
typing_extensions==4.7.1
|
| 171 |
+
tzdata==2023.3
|
| 172 |
+
tzlocal==4.3.1
|
| 173 |
+
uc-micro-py==1.0.2
|
| 174 |
+
urllib3==1.26.16
|
| 175 |
+
uvicorn==0.23.2
|
| 176 |
+
validators==0.21.2
|
| 177 |
+
wandb==0.15.8
|
| 178 |
+
wasabi==0.10.1
|
| 179 |
+
watchdog==3.0.0
|
| 180 |
+
websockets==11.0.3
|
| 181 |
+
Werkzeug==2.3.7
|
| 182 |
+
xxhash==3.3.0
|
| 183 |
+
yarl==1.9.2
|
| 184 |
+
zipp==3.16.2
|