sdutta28 commited on
Commit
e8cc53e
2 Parent(s): e9d2866 a9cf73b

Merge pull request #8 from Dutta-SD/develop

Browse files
Files changed (3) hide show
  1. README.md +1 -3
  2. app.py +49 -19
  3. requirements.txt +94 -11
README.md CHANGED
@@ -5,9 +5,7 @@ colorTo: blue
5
  sdk: gradio
6
  app_file: app.py
7
  pinned: false
8
- sdk: gradio
9
- sdk_version: 2.7.0
10
- python_version:
11
  ---
12
 
13
  # Agression and Misogyny Detection App
 
5
  sdk: gradio
6
  app_file: app.py
7
  pinned: false
8
+ python_version: 3.10.5
 
 
9
  ---
10
 
11
  # Agression and Misogyny Detection App
app.py CHANGED
@@ -1,27 +1,57 @@
1
  from components.get_predictions import get_predictions
2
- import gradio
 
 
3
 
4
 
5
- if __name__ == "__main__":
6
- interface = gradio.Interface(
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  get_predictions,
8
- inputs=gradio.inputs.Textbox(
9
- lines=2,
10
- placeholder="Enter The Text",
11
- default="",
12
- label="Text to Predict",
13
- ),
14
- outputs=[
15
- gradio.outputs.Textbox(type="str", label="Aggression Prediction"),
16
- gradio.outputs.Textbox(type="str", label="Misogyny Prediction"),
17
- ],
18
  title="Aggression and Misogyny Predictor",
19
- theme="dark-huggingface",
20
- live=True,
21
  )
22
 
 
 
 
 
 
 
23
  # Launch the interface
24
- interface.launch(
25
- share=False,
26
- debug=True,
27
- )
 
1
  from components.get_predictions import get_predictions
2
+ from gradio.components import Textbox
3
+ from gradio.interface import Interface
4
+ from gradio.themes import Monochrome
5
 
6
 
7
+ def get_input_fields() -> Textbox:
8
+ """Get Input Fields
9
+
10
+ Returns:
11
+ Textbox: Input Field as gradio TextBox
12
+ """
13
+ return Textbox(
14
+ lines=2,
15
+ placeholder="Enter The Text",
16
+ value="",
17
+ label="Text to Predict",
18
+ )
19
+
20
+
21
+ def get_output_fields() -> list[Textbox]:
22
+ """Gets Output Fields
23
+
24
+ Returns:
25
+ list[Textbox...]: output fields as gradio textbox
26
+ """
27
+
28
+ return [
29
+ Textbox(type="text", label="Aggression Prediction"),
30
+ Textbox(type="text", label="Misogyny Prediction"),
31
+ ]
32
+
33
+
34
+ def get_interface() -> Interface:
35
+ """Gets the Interface with Input and Outputs
36
+
37
+ Returns:
38
+ Interface: gradio interface
39
+ """
40
+
41
+ interface = Interface(
42
  get_predictions,
43
+ inputs=get_input_fields(),
44
+ outputs=get_output_fields(),
 
 
 
 
 
 
 
 
45
  title="Aggression and Misogyny Predictor",
46
+ theme=Monochrome(),
47
+ live=False,
48
  )
49
 
50
+ return interface
51
+
52
+
53
+ if __name__ == "__main__":
54
+ interface = get_interface()
55
+
56
  # Launch the interface
57
+ interface.launch(share=False, debug=True)
 
 
 
requirements.txt CHANGED
@@ -1,12 +1,95 @@
1
- gradio==2.7.0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  xgboost==0.90
3
- numpy
4
- pandas
5
- matplotlib
6
- flask
7
- jinja2
8
- pillow
9
- nltk
10
- joblib
11
- scikit-learn
12
- black
 
1
+ aiofiles==23.1.0
2
+ aiohttp==3.8.4
3
+ aiosignal==1.3.1
4
+ altair==5.0.1
5
+ analytics-python==1.4.post1
6
+ anyio==3.7.0
7
+ async-timeout==4.0.2
8
+ attrs==23.1.0
9
+ backoff==1.10.0
10
+ bcrypt==4.0.1
11
+ black==23.3.0
12
+ blinker==1.6.2
13
+ certifi==2023.5.7
14
+ cffi==1.15.1
15
+ charset-normalizer==3.1.0
16
+ click==8.1.3
17
+ colorama==0.4.6
18
+ contourpy==1.1.0
19
+ cryptography==41.0.1
20
+ cycler==0.11.0
21
+ exceptiongroup==1.1.1
22
+ fastapi==0.97.0
23
+ ffmpy==0.3.0
24
+ filelock==3.12.2
25
+ Flask==2.3.2
26
+ Flask-CacheBuster==1.0.0
27
+ Flask-Cors==3.0.10
28
+ Flask-Login==0.6.2
29
+ fonttools==4.40.0
30
+ frozenlist==1.3.3
31
+ fsspec==2023.6.0
32
+ gradio==3.35.2
33
+ gradio_client==0.2.7
34
+ h11==0.14.0
35
+ httpcore==0.17.2
36
+ httpx==0.24.1
37
+ huggingface-hub==0.15.1
38
+ idna==3.4
39
+ itsdangerous==2.1.2
40
+ Jinja2==3.1.2
41
+ joblib==1.2.0
42
+ jsonschema==4.17.3
43
+ kiwisolver==1.4.4
44
+ linkify-it-py==2.0.2
45
+ markdown-it-py==2.2.0
46
+ markdown2==2.4.8
47
+ MarkupSafe==2.1.3
48
+ matplotlib==3.7.1
49
+ mdit-py-plugins==0.3.3
50
+ mdurl==0.1.2
51
+ monotonic==1.6
52
+ multidict==6.0.4
53
+ mypy-extensions==1.0.0
54
+ nltk==3.8.1
55
+ numpy==1.24.3
56
+ orjson==3.9.1
57
+ packaging==23.1
58
+ pandas==2.0.2
59
+ paramiko==3.2.0
60
+ pathspec==0.11.1
61
+ Pillow==9.5.0
62
+ platformdirs==3.5.3
63
+ pycparser==2.21
64
+ pycryptodome==3.18.0
65
+ pydantic==1.10.9
66
+ pydub==0.25.1
67
+ Pygments==2.15.1
68
+ PyNaCl==1.5.0
69
+ pyparsing==3.0.9
70
+ pyrsistent==0.19.3
71
+ python-dateutil==2.8.2
72
+ python-multipart==0.0.6
73
+ pytz==2023.3
74
+ PyYAML==6.0
75
+ regex==2023.6.3
76
+ requests==2.31.0
77
+ scikit-learn==1.2.2
78
+ scipy==1.10.1
79
+ semantic-version==2.10.0
80
+ six==1.16.0
81
+ sniffio==1.3.0
82
+ starlette==0.27.0
83
+ threadpoolctl==3.1.0
84
+ tomli==2.0.1
85
+ toolz==0.12.0
86
+ tqdm==4.65.0
87
+ typing_extensions==4.6.3
88
+ tzdata==2023.3
89
+ uc-micro-py==1.0.2
90
+ urllib3==2.0.3
91
+ uvicorn==0.22.0
92
+ websockets==11.0.3
93
+ Werkzeug==2.3.6
94
  xgboost==0.90
95
+ yarl==1.9.2