Jaume commited on
Commit
16998ad
·
0 Parent(s):

initial commit

Browse files
.gitattributes ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz filter=lfs diff=lfs merge=lfs -text
33
+ *.zip filter=lfs diff=lfs merge=lfs -text
34
+ *.zst filter=lfs diff=lfs merge=lfs -text
35
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ *.png filter=lfs diff=lfs merge=lfs -text
.gitignore ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ .DS_Store
2
+ __pycache__
3
+
4
+ .env
README.md ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Write4All
3
+ emoji: ✍️✅
4
+ colorFrom: pink
5
+ colorTo: green
6
+ sdk: gradio
7
+ sdk_version: 4.25.0
8
+ app_file: app.py
9
+ pinned: true
10
+ license: mit
11
+ ---
12
+
13
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
14
+
15
+
16
+ ## Running the app
17
+
18
+ ```bash
19
+ poetry install
20
+ poetry run gradio app.py
21
+ ```
22
+
23
+ Update the requirements.txt file with the following command:
24
+ ```bash
25
+ poetry export --without-hashes --without dev -f requirements.txt -o requirements.txt
26
+ ```
app.py ADDED
@@ -0,0 +1,191 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import re
2
+ import os
3
+ import gradio as gr
4
+ import json
5
+ from functools import cache
6
+
7
+ import google.generativeai as genai
8
+
9
+
10
+ try:
11
+ from dotenv import load_dotenv
12
+
13
+ load_dotenv()
14
+ except:
15
+ pass
16
+
17
+ generation_config = {
18
+ "temperature": 0.9, # Temperature of the sampling distribution
19
+ "top_p": 1, # Probability of sampling from the top p tokens
20
+ "top_k": 1, # Number of top tokens to sample from
21
+ "max_output_tokens": 2048,
22
+ }
23
+
24
+ safety_settings = [
25
+ {"category": "HARM_CATEGORY_HARASSMENT", "threshold": "BLOCK_NONE"},
26
+ {"category": "HARM_CATEGORY_HATE_SPEECH", "threshold": "BLOCK_NONE"},
27
+ {"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT", "threshold": "BLOCK_NONE"},
28
+ {"category": "HARM_CATEGORY_DANGEROUS_CONTENT", "threshold": "BLOCK_ONLY_HIGH"},
29
+ ]
30
+
31
+ genai.configure(api_key=os.getenv("GEMINI_API_KEY"))
32
+
33
+ text_model = genai.GenerativeModel(
34
+ model_name="gemini-1.0-pro",
35
+ generation_config=generation_config,
36
+ safety_settings=safety_settings,
37
+ )
38
+ vision_model = genai.GenerativeModel(
39
+ "gemini-pro-vision",
40
+ generation_config=generation_config,
41
+ safety_settings=safety_settings,
42
+ )
43
+
44
+
45
+ @cache
46
+ def get_file(path: str) -> str:
47
+ with open(path) as f:
48
+ return f.read()
49
+
50
+
51
+ def fix_json(json_str: str) -> str:
52
+ template = get_file("templates/prompt_json_fix.txt")
53
+ prompt = template.format(json=json_str)
54
+ response = text_model.generate_content(prompt).text
55
+ return response.split("```json")[1].split("```")[0]
56
+
57
+
58
+ def get_json_content(response: str) -> dict:
59
+ print(response)
60
+ if "```json" not in response:
61
+ return []
62
+ raw_json = response.split("```json")[1].split("```")[0]
63
+ try:
64
+ return json.loads(raw_json)
65
+ except json.JSONDecodeError as e:
66
+ print(e)
67
+ new_json = fix_json(raw_json)
68
+ print(new_json)
69
+ return json.loads(new_json)
70
+
71
+
72
+ def review_text(text: str) -> list[dict]:
73
+ template = get_file("templates/prompt_v1.txt")
74
+ try:
75
+ response = text_model.generate_content(template.format(text=text)).text
76
+ except ValueError as e:
77
+ print(e)
78
+ raise ValueError(
79
+ f"Error while getting answer from the model, make sure the content isn't offensive or dangerous."
80
+ )
81
+ return get_json_content(response)
82
+
83
+
84
+ def review_image(image) -> list[dict]:
85
+ prompt = get_file("templates/prompt_image_v1.txt")
86
+ try:
87
+ response = vision_model.generate_content([prompt, image]).text
88
+ except ValueError as e:
89
+ print(e)
90
+ message = "Error while getting answer from the model, make sure the content isn't offensive or dangerous. Please try again or change the prompt."
91
+ gr.Error(message)
92
+ raise ValueError(message)
93
+ return response
94
+
95
+
96
+ def html_title(title: str) -> str:
97
+ return f"<h1>{title}</h1>"
98
+
99
+
100
+ def apply_review(text: str, review: list[dict]) -> str:
101
+ output = ""
102
+ review = sorted(review, key=lambda x: x["start_char"])
103
+ last_end = 0
104
+ for entity in review:
105
+ starts = [
106
+ m.start() + last_end
107
+ for m in re.finditer(entity["term"].lower(), text[last_end:].lower())
108
+ ]
109
+ if len(starts) > 0:
110
+ start = starts[0]
111
+ end = start + len(entity["term"])
112
+ output += text[last_end:start]
113
+ output += get_file("templates/correction.html").format(
114
+ term=text[start:end], fix=entity["fix"], kind=entity["type"]
115
+ )
116
+ last_end = end
117
+ output += text[last_end:]
118
+ return output
119
+
120
+
121
+ def review_table_summary(review: list[dict]) -> str:
122
+ table = "<table><tr><th>Term</th><th>Fix</th><th>Type</th><th>Reason</th></tr>"
123
+ for entity in review:
124
+ table += f"<tr><td>{entity['term']}</td><td>{entity['fix']}</td><td>{entity['type']}</td><td>{entity.get('reason', '-')}</td></tr>"
125
+ table += "</table>"
126
+ return table
127
+
128
+
129
+ def format_entities(text: str, review: list[dict]) -> list[dict]:
130
+ entities = []
131
+ for entity in review:
132
+ # Find all occurrences of the term in the text
133
+ starts = [m.start() for m in re.finditer(entity["term"], text)]
134
+ if len(starts) > 0:
135
+ entities.append(
136
+ {
137
+ "term": entity["term"],
138
+ "start": starts[0],
139
+ "end": starts[0] + len(entity["term"]),
140
+ "entity": entity["type"],
141
+ "fix": entity["fix"],
142
+ }
143
+ )
144
+ else:
145
+ print(f"Term '{entity['term']}' not found in the text: '{text}'")
146
+ return entities
147
+
148
+
149
+ def process_text(text):
150
+ review = review_text(text)
151
+ if len(review) == 0:
152
+ return html_title("No issues found in the text 🎉🎉🎉")
153
+ return (
154
+ html_title("Reviewed text")
155
+ + apply_review(text, review)
156
+ + html_title("Explanation")
157
+ + review_table_summary(review)
158
+ )
159
+
160
+
161
+ def process_image(image):
162
+ print(image)
163
+ return review_image(image)
164
+
165
+
166
+ text_ui = gr.Interface(
167
+ fn=process_text,
168
+ inputs=["text"],
169
+ outputs=[gr.HTML(label="Revision")],
170
+ examples=[
171
+ "The whitelist is incomplete.",
172
+ "There's not enough manpower to deliver the project",
173
+ "This has never happened in the history of mankind!",
174
+ "El hombre desciende del mono.",
175
+ "Els homes són animals",
176
+ ],
177
+ )
178
+
179
+ image_ui = gr.Interface(
180
+ fn=process_image,
181
+ inputs=gr.Image(sources=["upload", "clipboard"], type="pil"),
182
+ outputs=["markdown"],
183
+ examples=["static/images/CEOs.png", "static/images/meat_grid.png"],
184
+ )
185
+
186
+ with gr.Blocks() as demo:
187
+ gr.Markdown(get_file("static/intro.md"))
188
+ gr.TabbedInterface([text_ui, image_ui], ["Check texts", "Check images"])
189
+
190
+ if __name__ == "__main__":
191
+ demo.launch()
poetry.lock ADDED
The diff for this file is too large to render. See raw diff
 
pyproject.toml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [tool.poetry]
2
+ name = "inclu-v1"
3
+ version = "0.1.0"
4
+ description = ""
5
+ authors = ["Jaume Ferrarons <jaume.ferrarons@gmail.com>"]
6
+ readme = "README.md"
7
+
8
+ [tool.poetry.dependencies]
9
+ python = "^3.10"
10
+ gradio = "^4.25.0"
11
+ google-generativeai = "^0.4.1"
12
+
13
+
14
+ [tool.poetry.group.dev.dependencies]
15
+ python-dotenv = "^1.0.1"
16
+
17
+ [build-system]
18
+ requires = ["poetry-core"]
19
+ build-backend = "poetry.core.masonry.api"
requirements.txt ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ aiofiles==23.2.1 ; python_version >= "3.10" and python_version < "4.0"
2
+ altair==5.3.0 ; python_version >= "3.10" and python_version < "4.0"
3
+ annotated-types==0.6.0 ; python_version >= "3.10" and python_version < "4.0"
4
+ anyio==4.3.0 ; python_version >= "3.10" and python_version < "4.0"
5
+ attrs==23.2.0 ; python_version >= "3.10" and python_version < "4.0"
6
+ cachetools==5.3.3 ; python_version >= "3.10" and python_version < "4.0"
7
+ certifi==2024.2.2 ; python_version >= "3.10" and python_version < "4.0"
8
+ charset-normalizer==3.3.2 ; python_version >= "3.10" and python_version < "4.0"
9
+ click==8.1.7 ; python_version >= "3.10" and python_version < "4.0" and sys_platform != "emscripten"
10
+ colorama==0.4.6 ; python_version >= "3.10" and python_version < "4.0" and platform_system == "Windows"
11
+ contourpy==1.2.1 ; python_version >= "3.10" and python_version < "4.0"
12
+ cycler==0.12.1 ; python_version >= "3.10" and python_version < "4.0"
13
+ exceptiongroup==1.2.0 ; python_version >= "3.10" and python_version < "3.11"
14
+ fastapi==0.110.1 ; python_version >= "3.10" and python_version < "4.0"
15
+ ffmpy==0.3.2 ; python_version >= "3.10" and python_version < "4.0"
16
+ filelock==3.13.3 ; python_version >= "3.10" and python_version < "4.0"
17
+ fonttools==4.50.0 ; python_version >= "3.10" and python_version < "4.0"
18
+ fsspec==2024.3.1 ; python_version >= "3.10" and python_version < "4.0"
19
+ google-ai-generativelanguage==0.4.0 ; python_version >= "3.10" and python_version < "4.0"
20
+ google-api-core==2.18.0 ; python_version >= "3.10" and python_version < "4.0"
21
+ google-api-core[grpc]==2.18.0 ; python_version >= "3.10" and python_version < "4.0"
22
+ google-auth==2.29.0 ; python_version >= "3.10" and python_version < "4.0"
23
+ google-generativeai==0.4.1 ; python_version >= "3.10" and python_version < "4.0"
24
+ googleapis-common-protos==1.63.0 ; python_version >= "3.10" and python_version < "4.0"
25
+ gradio-client==0.15.0 ; python_version >= "3.10" and python_version < "4.0"
26
+ gradio==4.25.0 ; python_version >= "3.10" and python_version < "4.0"
27
+ grpcio-status==1.62.1 ; python_version < "4.0" and python_version >= "3.10"
28
+ grpcio==1.62.1 ; python_version < "4.0" and python_version >= "3.10"
29
+ h11==0.14.0 ; python_version >= "3.10" and python_version < "4.0"
30
+ httpcore==1.0.5 ; python_version >= "3.10" and python_version < "4.0"
31
+ httpx==0.27.0 ; python_version >= "3.10" and python_version < "4.0"
32
+ huggingface-hub==0.22.2 ; python_version >= "3.10" and python_version < "4.0"
33
+ idna==3.6 ; python_version >= "3.10" and python_version < "4.0"
34
+ importlib-resources==6.4.0 ; python_version >= "3.10" and python_version < "4.0"
35
+ jinja2==3.1.3 ; python_version >= "3.10" and python_version < "4.0"
36
+ jsonschema-specifications==2023.12.1 ; python_version >= "3.10" and python_version < "4.0"
37
+ jsonschema==4.21.1 ; python_version >= "3.10" and python_version < "4.0"
38
+ kiwisolver==1.4.5 ; python_version >= "3.10" and python_version < "4.0"
39
+ markdown-it-py==3.0.0 ; python_version >= "3.10" and python_version < "4.0" and sys_platform != "emscripten"
40
+ markupsafe==2.1.5 ; python_version >= "3.10" and python_version < "4.0"
41
+ matplotlib==3.8.3 ; python_version >= "3.10" and python_version < "4.0"
42
+ mdurl==0.1.2 ; python_version >= "3.10" and python_version < "4.0" and sys_platform != "emscripten"
43
+ numpy==1.26.4 ; python_version >= "3.10" and python_version < "4.0"
44
+ orjson==3.10.0 ; python_version >= "3.10" and python_version < "4.0"
45
+ packaging==24.0 ; python_version >= "3.10" and python_version < "4.0"
46
+ pandas==2.2.1 ; python_version >= "3.10" and python_version < "4.0"
47
+ pillow==10.3.0 ; python_version >= "3.10" and python_version < "4.0"
48
+ proto-plus==1.23.0 ; python_version >= "3.10" and python_version < "4.0"
49
+ protobuf==4.25.3 ; python_version >= "3.10" and python_version < "4.0"
50
+ pyasn1-modules==0.4.0 ; python_version >= "3.10" and python_version < "4.0"
51
+ pyasn1==0.6.0 ; python_version >= "3.10" and python_version < "4.0"
52
+ pydantic-core==2.16.3 ; python_version >= "3.10" and python_version < "4.0"
53
+ pydantic==2.6.4 ; python_version >= "3.10" and python_version < "4.0"
54
+ pydub==0.25.1 ; python_version >= "3.10" and python_version < "4.0"
55
+ pygments==2.17.2 ; python_version >= "3.10" and python_version < "4.0" and sys_platform != "emscripten"
56
+ pyparsing==3.1.2 ; python_version >= "3.10" and python_version < "4.0"
57
+ python-dateutil==2.9.0.post0 ; python_version >= "3.10" and python_version < "4.0"
58
+ python-multipart==0.0.9 ; python_version >= "3.10" and python_version < "4.0"
59
+ pytz==2024.1 ; python_version >= "3.10" and python_version < "4.0"
60
+ pyyaml==6.0.1 ; python_version >= "3.10" and python_version < "4.0"
61
+ referencing==0.34.0 ; python_version >= "3.10" and python_version < "4.0"
62
+ requests==2.31.0 ; python_version >= "3.10" and python_version < "4.0"
63
+ rich==13.7.1 ; python_version >= "3.10" and python_version < "4.0" and sys_platform != "emscripten"
64
+ rpds-py==0.18.0 ; python_version >= "3.10" and python_version < "4.0"
65
+ rsa==4.9 ; python_version >= "3.10" and python_version < "4"
66
+ ruff==0.3.5 ; python_version >= "3.10" and python_version < "4.0" and sys_platform != "emscripten"
67
+ semantic-version==2.10.0 ; python_version >= "3.10" and python_version < "4.0"
68
+ shellingham==1.5.4 ; python_version >= "3.10" and python_version < "4.0" and sys_platform != "emscripten"
69
+ six==1.16.0 ; python_version >= "3.10" and python_version < "4.0"
70
+ sniffio==1.3.1 ; python_version >= "3.10" and python_version < "4.0"
71
+ starlette==0.37.2 ; python_version >= "3.10" and python_version < "4.0"
72
+ tomlkit==0.12.0 ; python_version >= "3.10" and python_version < "4.0"
73
+ toolz==0.12.1 ; python_version >= "3.10" and python_version < "4.0"
74
+ tqdm==4.66.2 ; python_version >= "3.10" and python_version < "4.0"
75
+ typer-cli==0.12.0 ; python_version >= "3.10" and python_version < "4.0" and sys_platform != "emscripten"
76
+ typer-slim[standard]==0.12.0 ; python_version >= "3.10" and python_version < "4.0" and sys_platform != "emscripten"
77
+ typer[all]==0.12.0 ; python_version >= "3.10" and python_version < "4.0" and sys_platform != "emscripten"
78
+ typing-extensions==4.10.0 ; python_version >= "3.10" and python_version < "4.0"
79
+ tzdata==2024.1 ; python_version >= "3.10" and python_version < "4.0"
80
+ urllib3==2.2.1 ; python_version >= "3.10" and python_version < "4.0"
81
+ uvicorn==0.29.0 ; python_version >= "3.10" and python_version < "4.0" and sys_platform != "emscripten"
82
+ websockets==11.0.3 ; python_version >= "3.10" and python_version < "4.0"
static/images/CEOs.png ADDED

Git LFS Details

  • SHA256: c4184d03b7033d32ac000900c2b7e102808aa3e74c01dc4b8a0e750df4f8e42a
  • Pointer size: 132 Bytes
  • Size of remote file: 5.67 MB
static/images/meat_grid.png ADDED

Git LFS Details

  • SHA256: b93bef2748095da1c34d3d56d836a106bb5e5ed878103776f993f5fcefb339f7
  • Pointer size: 132 Bytes
  • Size of remote file: 4.72 MB
static/intro.md ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ # ✅ Write4All - Create the right for everyone
2
+
3
+ Use ✅ Write4All to review your content and make sure it is respectful and inclusive. Use the results under taking into account the context and decide if you finally need to make proposed changes.
4
+
5
+ > Terms of use: You won't use this app to produce harmful content, promote hate speech, violence, or discrimination. You agree to the terms of use of Gemini API. By using this app, you agree to the terms of use of the models used in this app.
templates/correction.html ADDED
@@ -0,0 +1 @@
 
 
1
+ <span title="{kind}"><span style='background-color:#FF5555; color:black; text-decoration:line-through; text-decoration-thickness: 2px; min-height: 22px; display: inline-block; border-radius: 5px 0 0 5px; padding-left: 5px;'>{term}</span><span style='background-color:#55FF55; color:black; min-height: 22px; display: inline-block; border-radius: 0 5px 5px 0; padding-right: 5px;'>{fix}</span></span>
templates/prompt_image_v1 copy.txt ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ Analyze the following image in terms of inclusivity.
2
+
3
+ You must:
4
+ - Provide a brief description of the image and explain why it is inclusive or exclusive.
5
+ - When the picture is exclusive make sure to provide a table with to columns: "problem" and "solution". In the problem column, list the issues with the image. In the solution column, provide a solution to the problem.
6
+ - When the image is inclusive, provide a brief explanation of why it is inclusive.
7
+ - In case the picture contains people, consider inclusivity in the following dimensions: gender, ethnicity, age, ability, etc.
8
+ - Only talk about people when there is people in the picture.
templates/prompt_image_v1.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ Analyze the following image in terms of inclusivity.
2
+
3
+ Provide a brief description of the image and explain how it is inclusive or exclusive. Then if it's exclusive provide a table with to columns: "problem" and "solution". In the problem column, list the issues with the image. In the solution column, provide a solution to the problem.
4
+ Otherwise, if the image is inclusive, provide a brief explanation of why it is inclusive.
templates/prompt_json_fix.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ Could you fix the following JSON?
2
+
3
+ {json}
templates/prompt_v1.txt ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Provide tips to improve the following text regarding inclusivity. Use the following classification:
2
+ - "gender-exclusive": use of terms that exclude non-binary or gender-diverse individuals
3
+ - "stereotyping": Making assumptions based on characteristics like race, gender, or disability.
4
+ - "ableism": Stigmatizing disabilities or mental health conditions.
5
+ - "religion/culture": Using language that offends specific religious or cultural groups.
6
+ - "body-stigma": Perpetuating negative stereotypes about body size and appearance.
7
+ - "microagressions": Unintentional comments that marginalize or offend others.
8
+
9
+ You must:
10
+ - provide a single fix for each issue.
11
+ - the term should be as short as possible while including all the text that has to be replaced.
12
+ - ensure that replacing the term by the fix does not change the meaning of the text and lead to a grammatically correct sentence.
13
+ - briefly reason why the term is problematic.
14
+
15
+ Input:
16
+ ```
17
+ The policeman stopped the car
18
+ ```
19
+
20
+ Output:
21
+ ```json
22
+ [
23
+ {{
24
+ "term": "policeman",
25
+ "start_char": 4,
26
+ "end_char": 13,
27
+ "type": "gender-exclusive",
28
+ "fix": "police officer",
29
+ "reason": "police officer is gender neutral and not assuming the gender of the subject"
30
+ }}
31
+ ]
32
+ ```
33
+
34
+ Input:
35
+ ```
36
+ People who are overweight eat too much.
37
+ ```
38
+
39
+ Output:
40
+ ```json
41
+ [
42
+ {{
43
+ "term": "People who are overweight eat too much.",
44
+ "start_char": 0,
45
+ "end_char": 39,
46
+ "type": "body-stigma",
47
+ "fix": "Some people that eat too much are overweight.",
48
+ "reason": "Overweight can be a medical condition and not always related to eating to much"
49
+ }}
50
+ ]
51
+ ```
52
+
53
+ Input:
54
+ ```
55
+ {text}
56
+ ```
57
+
58
+ Output: