Spaces:
Sleeping
Sleeping
Added Dark Theme, modified UI
Browse files- .gitignore +194 -0
- README.md +2 -0
- app.py +6 -2
- get_predictions.py +2 -5
.gitignore
ADDED
@@ -0,0 +1,194 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
# Created by https://www.toptal.com/developers/gitignore/api/python,visualstudiocode,data
|
3 |
+
# Edit at https://www.toptal.com/developers/gitignore?templates=python,visualstudiocode,data
|
4 |
+
|
5 |
+
### Data ###
|
6 |
+
*.csv
|
7 |
+
*.dat
|
8 |
+
*.efx
|
9 |
+
*.gbr
|
10 |
+
*.key
|
11 |
+
*.pps
|
12 |
+
*.ppt
|
13 |
+
*.pptx
|
14 |
+
*.sdf
|
15 |
+
*.tax2010
|
16 |
+
*.vcf
|
17 |
+
*.xml
|
18 |
+
|
19 |
+
### Python ###
|
20 |
+
# Byte-compiled / optimized / DLL files
|
21 |
+
__pycache__/
|
22 |
+
*.py[cod]
|
23 |
+
*$py.class
|
24 |
+
|
25 |
+
# C extensions
|
26 |
+
*.so
|
27 |
+
|
28 |
+
# Distribution / packaging
|
29 |
+
.Python
|
30 |
+
build/
|
31 |
+
develop-eggs/
|
32 |
+
dist/
|
33 |
+
downloads/
|
34 |
+
eggs/
|
35 |
+
.eggs/
|
36 |
+
lib/
|
37 |
+
lib64/
|
38 |
+
parts/
|
39 |
+
sdist/
|
40 |
+
var/
|
41 |
+
wheels/
|
42 |
+
share/python-wheels/
|
43 |
+
*.egg-info/
|
44 |
+
.installed.cfg
|
45 |
+
*.egg
|
46 |
+
MANIFEST
|
47 |
+
|
48 |
+
# PyInstaller
|
49 |
+
# Usually these files are written by a python script from a template
|
50 |
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
51 |
+
*.manifest
|
52 |
+
*.spec
|
53 |
+
|
54 |
+
# Installer logs
|
55 |
+
pip-log.txt
|
56 |
+
pip-delete-this-directory.txt
|
57 |
+
|
58 |
+
# Unit test / coverage reports
|
59 |
+
htmlcov/
|
60 |
+
.tox/
|
61 |
+
.nox/
|
62 |
+
.coverage
|
63 |
+
.coverage.*
|
64 |
+
.cache
|
65 |
+
nosetests.xml
|
66 |
+
coverage.xml
|
67 |
+
*.cover
|
68 |
+
*.py,cover
|
69 |
+
.hypothesis/
|
70 |
+
.pytest_cache/
|
71 |
+
cover/
|
72 |
+
|
73 |
+
# Translations
|
74 |
+
*.mo
|
75 |
+
*.pot
|
76 |
+
|
77 |
+
# Django stuff:
|
78 |
+
*.log
|
79 |
+
local_settings.py
|
80 |
+
db.sqlite3
|
81 |
+
db.sqlite3-journal
|
82 |
+
|
83 |
+
# Flask stuff:
|
84 |
+
instance/
|
85 |
+
.webassets-cache
|
86 |
+
|
87 |
+
# Scrapy stuff:
|
88 |
+
.scrapy
|
89 |
+
|
90 |
+
# Sphinx documentation
|
91 |
+
docs/_build/
|
92 |
+
|
93 |
+
# PyBuilder
|
94 |
+
.pybuilder/
|
95 |
+
target/
|
96 |
+
|
97 |
+
# Jupyter Notebook
|
98 |
+
.ipynb_checkpoints
|
99 |
+
|
100 |
+
# IPython
|
101 |
+
profile_default/
|
102 |
+
ipython_config.py
|
103 |
+
|
104 |
+
# pyenv
|
105 |
+
# For a library or package, you might want to ignore these files since the code is
|
106 |
+
# intended to run in multiple environments; otherwise, check them in:
|
107 |
+
# .python-version
|
108 |
+
|
109 |
+
# pipenv
|
110 |
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
111 |
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
112 |
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
113 |
+
# install all needed dependencies.
|
114 |
+
#Pipfile.lock
|
115 |
+
|
116 |
+
# poetry
|
117 |
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
118 |
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
119 |
+
# commonly ignored for libraries.
|
120 |
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
121 |
+
#poetry.lock
|
122 |
+
|
123 |
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
124 |
+
__pypackages__/
|
125 |
+
|
126 |
+
# Celery stuff
|
127 |
+
celerybeat-schedule
|
128 |
+
celerybeat.pid
|
129 |
+
|
130 |
+
# SageMath parsed files
|
131 |
+
*.sage.py
|
132 |
+
|
133 |
+
# Environments
|
134 |
+
.env
|
135 |
+
.venv
|
136 |
+
env/
|
137 |
+
venv/
|
138 |
+
ENV/
|
139 |
+
env.bak/
|
140 |
+
venv.bak/
|
141 |
+
|
142 |
+
# Spyder project settings
|
143 |
+
.spyderproject
|
144 |
+
.spyproject
|
145 |
+
|
146 |
+
# Rope project settings
|
147 |
+
.ropeproject
|
148 |
+
|
149 |
+
# mkdocs documentation
|
150 |
+
/site
|
151 |
+
|
152 |
+
# mypy
|
153 |
+
.mypy_cache/
|
154 |
+
.dmypy.json
|
155 |
+
dmypy.json
|
156 |
+
|
157 |
+
# Pyre type checker
|
158 |
+
.pyre/
|
159 |
+
|
160 |
+
# pytype static type analyzer
|
161 |
+
.pytype/
|
162 |
+
|
163 |
+
# Cython debug symbols
|
164 |
+
cython_debug/
|
165 |
+
|
166 |
+
# PyCharm
|
167 |
+
# JetBrains specific template is maintainted in a separate JetBrains.gitignore that can
|
168 |
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
169 |
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
170 |
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
171 |
+
#.idea/
|
172 |
+
|
173 |
+
### VisualStudioCode ###
|
174 |
+
.vscode/*
|
175 |
+
!.vscode/settings.json
|
176 |
+
!.vscode/tasks.json
|
177 |
+
!.vscode/launch.json
|
178 |
+
!.vscode/extensions.json
|
179 |
+
!.vscode/*.code-snippets
|
180 |
+
|
181 |
+
# Local History for Visual Studio Code
|
182 |
+
.history/
|
183 |
+
|
184 |
+
# Built Visual Studio Code Extensions
|
185 |
+
*.vsix
|
186 |
+
|
187 |
+
### VisualStudioCode Patch ###
|
188 |
+
# Ignore all local history of files
|
189 |
+
.history
|
190 |
+
.ionide
|
191 |
+
|
192 |
+
# Support for Project snippet scope
|
193 |
+
|
194 |
+
# End of https://www.toptal.com/developers/gitignore/api/python,visualstudiocode,data
|
README.md
CHANGED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
# Aggression Detection App
|
2 |
+
|
app.py
CHANGED
@@ -7,6 +7,10 @@ if __name__ == "__main__":
|
|
7 |
interface = gradio.Interface(
|
8 |
get_predictions,
|
9 |
inputs="text",
|
10 |
-
outputs="text",
|
|
|
|
|
|
|
|
|
|
|
11 |
)
|
12 |
-
interface.launch(title="Aggression and Misogyny Predictor")
|
|
|
7 |
interface = gradio.Interface(
|
8 |
get_predictions,
|
9 |
inputs="text",
|
10 |
+
outputs=["text", "text"],
|
11 |
+
title="Aggression and Misogyny Predictor",
|
12 |
+
theme="dark-huggingface",
|
13 |
+
)
|
14 |
+
interface.launch(
|
15 |
+
share=False,
|
16 |
)
|
|
get_predictions.py
CHANGED
@@ -3,7 +3,7 @@ import utils
|
|
3 |
import joblib
|
4 |
|
5 |
|
6 |
-
def get_predictions(text: str) ->
|
7 |
"""
|
8 |
Returns predictions of aggressions and misogyny as per the model
|
9 |
"""
|
@@ -17,10 +17,7 @@ def get_predictions(text: str) -> dict:
|
|
17 |
pred_1 = model_1.predict(cleaned_data)[0]
|
18 |
pred_2 = model_2.predict(cleaned_data)[0]
|
19 |
|
20 |
-
return
|
21 |
-
"task_1_pred": utils.TASK_1_MAP[pred_1],
|
22 |
-
"task_2_pred": utils.TASK_2_MAP[pred_2],
|
23 |
-
}
|
24 |
|
25 |
|
26 |
if __name__ == "__main__":
|
|
|
3 |
import joblib
|
4 |
|
5 |
|
6 |
+
def get_predictions(text: str) -> tuple:
|
7 |
"""
|
8 |
Returns predictions of aggressions and misogyny as per the model
|
9 |
"""
|
|
|
17 |
pred_1 = model_1.predict(cleaned_data)[0]
|
18 |
pred_2 = model_2.predict(cleaned_data)[0]
|
19 |
|
20 |
+
return (utils.TASK_1_MAP[pred_1], utils.TASK_2_MAP[pred_2])
|
|
|
|
|
|
|
21 |
|
22 |
|
23 |
if __name__ == "__main__":
|