ShynBui commited on
Commit
b731904
1 Parent(s): 598ec7a

first commit

Browse files
.idea/.gitignore ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # Default ignored files
2
+ /shelf/
3
+ /workspace.xml
.idea/Vietnamese_classification.iml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="PYTHON_MODULE" version="4">
3
+ <component name="NewModuleRootManager">
4
+ <content url="file://$MODULE_DIR$">
5
+ <excludeFolder url="file://$MODULE_DIR$/venv" />
6
+ </content>
7
+ <orderEntry type="inheritedJdk" />
8
+ <orderEntry type="sourceFolder" forTests="false" />
9
+ </component>
10
+ </module>
.idea/inspectionProfiles/profiles_settings.xml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ <component name="InspectionProjectProfileManager">
2
+ <settings>
3
+ <option name="USE_PROJECT_PROFILE" value="false" />
4
+ <version value="1.0" />
5
+ </settings>
6
+ </component>
.idea/misc.xml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9 (Vietnamese_classification)" project-jdk-type="Python SDK" />
4
+ </project>
.idea/modules.xml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/Vietnamese_classification.iml" filepath="$PROJECT_DIR$/.idea/Vietnamese_classification.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
.idea/vcs.xml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="" vcs="Git" />
5
+ </component>
6
+ </project>
__pycache__/utils.cpython-39.pyc ADDED
Binary file (317 Bytes). View file
 
app.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+
3
+ from utils import *
4
+ from transformers import pipeline
5
+ import gradio as gr
6
+
7
+
8
+ pipe = pipeline("text-classification", model="ShynBui/comment_classification_v2", token=os.environ['HF_TOKEN'])
9
+
10
+
11
+
12
+ def classification(text):
13
+ classi = pipe(covert_pyVI(text))
14
+
15
+ return classi[0]['label'], classi[0]['score']
16
+
17
+ iface = gr.Interface(fn=classification, inputs="text", outputs=["text", "text"])
18
+ iface.launch()
requirements.txt ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## The following requirements were added by pip freeze:
2
+ aiofiles==23.2.1
3
+ altair==5.3.0
4
+ annotated-types==0.6.0
5
+ anyio==4.3.0
6
+ attrs==23.2.0
7
+ certifi==2024.2.2
8
+ charset-normalizer==3.3.2
9
+ click==8.1.7
10
+ colorama==0.4.6
11
+ contourpy==1.2.1
12
+ cycler==0.12.1
13
+ exceptiongroup==1.2.1
14
+ fastapi==0.110.2
15
+ ffmpy==0.3.2
16
+ filelock==3.13.4
17
+ fonttools==4.51.0
18
+ fsspec==2024.3.1
19
+ gradio==4.27.0
20
+ gradio_client==0.15.1
21
+ h11==0.14.0
22
+ httpcore==1.0.5
23
+ httpx==0.27.0
24
+ huggingface-hub==0.22.2
25
+ idna==3.7
26
+ importlib_resources==6.4.0
27
+ Jinja2==3.1.3
28
+ joblib==1.4.0
29
+ jsonschema==4.21.1
30
+ jsonschema-specifications==2023.12.1
31
+ kiwisolver==1.4.5
32
+ markdown-it-py==3.0.0
33
+ MarkupSafe==2.1.5
34
+ matplotlib==3.8.4
35
+ mdurl==0.1.2
36
+ mpmath==1.3.0
37
+ networkx==3.2.1
38
+ numpy==1.26.4
39
+ orjson==3.10.1
40
+ packaging==24.0
41
+ pandas==2.2.2
42
+ pillow==10.3.0
43
+ pydantic==2.7.0
44
+ pydantic_core==2.18.1
45
+ pydub==0.25.1
46
+ Pygments==2.17.2
47
+ pyparsing==3.1.2
48
+ python-crfsuite==0.9.10
49
+ python-dateutil==2.9.0.post0
50
+ python-multipart==0.0.9
51
+ pytz==2024.1
52
+ pyvi==0.1.1
53
+ PyYAML==6.0.1
54
+ referencing==0.34.0
55
+ regex==2024.4.16
56
+ requests==2.31.0
57
+ rich==13.7.1
58
+ rpds-py==0.18.0
59
+ ruff==0.4.1
60
+ safetensors==0.4.3
61
+ scikit-learn==1.4.2
62
+ scipy==1.13.0
63
+ semantic-version==2.10.0
64
+ shellingham==1.5.4
65
+ six==1.16.0
66
+ sklearn-crfsuite==0.3.6
67
+ sniffio==1.3.1
68
+ starlette==0.37.2
69
+ sympy==1.12
70
+ tabulate==0.9.0
71
+ threadpoolctl==3.4.0
72
+ tokenizers==0.19.1
73
+ tomlkit==0.12.0
74
+ toolz==0.12.1
75
+ torch==2.2.2
76
+ tqdm==4.66.2
77
+ transformers==4.40.0
78
+ typer==0.12.3
79
+ typing_extensions==4.11.0
80
+ tzdata==2024.1
81
+ urllib3==2.2.1
82
+ uvicorn==0.29.0
83
+ websockets==11.0.3
84
+ zipp==3.18.1
utils.py ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ from pyvi import ViTokenizer, ViPosTagger
2
+
3
+ def covert_pyVI(text):
4
+ return ViTokenizer.tokenize(text)