custovox-visual 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,222 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ # Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ # uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ # poetry.lock
109
+ # poetry.toml
110
+
111
+ # pdm
112
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
114
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
115
+ # pdm.lock
116
+ # pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # pixi
121
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
122
+ # pixi.lock
123
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
124
+ # in the .venv directory. It is recommended not to include this directory in version control.
125
+ .pixi
126
+
127
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
128
+ __pypackages__/
129
+
130
+ # Celery stuff
131
+ celerybeat-schedule
132
+ celerybeat.pid
133
+
134
+ # Redis
135
+ *.rdb
136
+ *.aof
137
+ *.pid
138
+
139
+ # RabbitMQ
140
+ mnesia/
141
+ rabbitmq/
142
+ rabbitmq-data/
143
+
144
+ # ActiveMQ
145
+ activemq-data/
146
+
147
+ # SageMath parsed files
148
+ *.sage.py
149
+
150
+ # Environments
151
+ .env
152
+ .envrc
153
+ .venv
154
+ env/
155
+ venv/
156
+ ENV/
157
+ env.bak/
158
+ venv.bak/
159
+
160
+ # Spyder project settings
161
+ .spyderproject
162
+ .spyproject
163
+
164
+ # Rope project settings
165
+ .ropeproject
166
+
167
+ # mkdocs documentation
168
+ /site
169
+
170
+ # mypy
171
+ .mypy_cache/
172
+ .dmypy.json
173
+ dmypy.json
174
+
175
+ # Pyre type checker
176
+ .pyre/
177
+
178
+ # pytype static type analyzer
179
+ .pytype/
180
+
181
+ # Cython debug symbols
182
+ cython_debug/
183
+
184
+ # PyCharm
185
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
186
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
187
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
188
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
189
+ # .idea/
190
+
191
+ # Abstra
192
+ # Abstra is an AI-powered process automation framework.
193
+ # Ignore directories containing user credentials, local state, and settings.
194
+ # Learn more at https://abstra.io/docs
195
+ .abstra/
196
+
197
+ # Visual Studio Code
198
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
199
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
200
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
201
+ # you could uncomment the following to ignore the entire vscode folder
202
+ # .vscode/
203
+ # Temporary file for partial code execution
204
+ tempCodeRunnerFile.py
205
+
206
+ # Ruff stuff:
207
+ .ruff_cache/
208
+
209
+ # PyPI configuration file
210
+ .pypirc
211
+
212
+ # Marimo
213
+ marimo/_static/
214
+ marimo/_lsp/
215
+ __marimo__/
216
+
217
+ # Streamlit
218
+ .streamlit/secrets.toml
219
+
220
+ # Statista PDFs used only to check figures: never published
221
+ _sources/
222
+ tools/node_modules/
@@ -0,0 +1,51 @@
1
+ Metadata-Version: 2.5
2
+ Name: custovox-visual
3
+ Version: 1.0.0
4
+ Summary: Customer photo triage MCP: English caption + likely issue category for hotel room, product return and retail photos. By custovox.ai
5
+ Project-URL: Homepage, https://custovox.ai
6
+ Project-URL: Repository, https://github.com/jeremdecustovox/custovox-ai
7
+ Project-URL: Documentation, https://custovox.ai
8
+ Author-email: Jérémie Muselet <jeremie@custovox.ai>
9
+ License: MIT
10
+ Keywords: custovox,ecommerce,hospitality,image-analysis,mcp,nlp,visual-analysis
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
16
+ Requires-Python: >=3.10
17
+ Requires-Dist: mcp<2,>=1.0.0
18
+ Requires-Dist: pillow>=10.0.0
19
+ Requires-Dist: requests>=2.31.0
20
+ Requires-Dist: torch>=2.0.0
21
+ Requires-Dist: transformers>=4.40.0
22
+ Description-Content-Type: text/markdown
23
+
24
+ # custovox-visual
25
+
26
+ <!-- mcp-name: io.github.jeremdecustovox/custovox-visual -->
27
+
28
+ MCP server for a first triage of customer-submitted photos (hotel rooms, product returns, retail, support tickets).
29
+
30
+ ## What it returns
31
+ One tool, `analyze_customer_image(image_url, context="general")` — `image_url` is an image URL or the image as a base64 string:
32
+ - `description`: an English caption of the image
33
+ - `detected_issue`: the most likely issue category (cleanliness, damage or defect, missing item, safety, maintenance, presentation, incorrect item, packaging, or no visible issue; with `context="hospitality"`: room cleanliness, missing amenities, maintenance, bathroom, bed or linen, view or room quality, or no visible problem)
34
+ - `issue_confidence`: the score of that category
35
+ - `severity`: none / low / medium / high, derived from that score
36
+ - `suggested_action`
37
+
38
+ ## How it works
39
+ - The image is captioned in English by `Salesforce/blip-image-captioning-base`.
40
+ - The caption is then classified into the issue categories with English zero-shot classification (`facebook/bart-large-mnli`). The category is inferred from the caption, not from the pixels directly: an issue the caption does not mention is not detected.
41
+ - `severity` reflects how confident the classification is, not how serious the issue is. Use it to sort photos for human review, not as a final verdict.
42
+ - Runs locally; the only network call is downloading the image when you pass a URL. Models are downloaded on first run.
43
+
44
+ ## Installation
45
+ ```
46
+ pip install custovox-visual
47
+ ```
48
+
49
+ ## Need more?
50
+ **custovox.ai** — Full customer intelligence platform. From $89/month.
51
+ https://custovox.ai
@@ -0,0 +1,28 @@
1
+ # custovox-visual
2
+
3
+ <!-- mcp-name: io.github.jeremdecustovox/custovox-visual -->
4
+
5
+ MCP server for a first triage of customer-submitted photos (hotel rooms, product returns, retail, support tickets).
6
+
7
+ ## What it returns
8
+ One tool, `analyze_customer_image(image_url, context="general")` — `image_url` is an image URL or the image as a base64 string:
9
+ - `description`: an English caption of the image
10
+ - `detected_issue`: the most likely issue category (cleanliness, damage or defect, missing item, safety, maintenance, presentation, incorrect item, packaging, or no visible issue; with `context="hospitality"`: room cleanliness, missing amenities, maintenance, bathroom, bed or linen, view or room quality, or no visible problem)
11
+ - `issue_confidence`: the score of that category
12
+ - `severity`: none / low / medium / high, derived from that score
13
+ - `suggested_action`
14
+
15
+ ## How it works
16
+ - The image is captioned in English by `Salesforce/blip-image-captioning-base`.
17
+ - The caption is then classified into the issue categories with English zero-shot classification (`facebook/bart-large-mnli`). The category is inferred from the caption, not from the pixels directly: an issue the caption does not mention is not detected.
18
+ - `severity` reflects how confident the classification is, not how serious the issue is. Use it to sort photos for human review, not as a final verdict.
19
+ - Runs locally; the only network call is downloading the image when you pass a URL. Models are downloaded on first run.
20
+
21
+ ## Installation
22
+ ```
23
+ pip install custovox-visual
24
+ ```
25
+
26
+ ## Need more?
27
+ **custovox.ai** — Full customer intelligence platform. From $89/month.
28
+ https://custovox.ai
@@ -0,0 +1,37 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "custovox-visual"
7
+ version = "1.0.0"
8
+ description = "Customer photo triage MCP: English caption + likely issue category for hotel room, product return and retail photos. By custovox.ai"
9
+ readme = "README.md"
10
+ license = {text = "MIT"}
11
+ authors = [{name = "Jérémie Muselet", email = "jeremie@custovox.ai"}]
12
+ keywords = ["mcp","visual-analysis","nlp","hospitality","ecommerce","image-analysis","custovox"]
13
+ classifiers = [
14
+ "Development Status :: 4 - Beta",
15
+ "Intended Audience :: Developers",
16
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
17
+ "License :: OSI Approved :: MIT License",
18
+ "Programming Language :: Python :: 3.10",
19
+ ]
20
+ requires-python = ">=3.10"
21
+ dependencies = ["mcp>=1.0.0,<2","transformers>=4.40.0","torch>=2.0.0","Pillow>=10.0.0","requests>=2.31.0"]
22
+
23
+ [project.urls]
24
+ Homepage = "https://custovox.ai"
25
+ Repository = "https://github.com/jeremdecustovox/custovox-ai"
26
+ Documentation = "https://custovox.ai"
27
+
28
+ [project.scripts]
29
+ custovox-visual = "custovox_visual.server:mcp.run"
30
+
31
+ # Installed as custovox_visual/server.py so it does not overwrite the
32
+ # top-level server.py of the other custovox MCP packages.
33
+ [tool.hatch.build.targets.wheel]
34
+ bypass-selection = true
35
+
36
+ [tool.hatch.build.targets.wheel.force-include]
37
+ "server.py" = "custovox_visual/server.py"
@@ -0,0 +1,5 @@
1
+ mcp>=1.0.0,<2
2
+ transformers>=4.40.0
3
+ torch>=2.0.0
4
+ Pillow>=10.0.0
5
+ requests>=2.31.0
@@ -0,0 +1,21 @@
1
+ {
2
+ "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
3
+ "name": "io.github.jeremdecustovox/custovox-visual",
4
+ "description": "custovox.ai visual customer intelligence MCP server: hotel rooms, product returns, retail images",
5
+ "repository": {
6
+ "url": "https://github.com/jeremdecustovox/custovox-ai",
7
+ "source": "github"
8
+ },
9
+ "websiteUrl": "https://custovox.ai",
10
+ "version": "1.0.0",
11
+ "packages": [
12
+ {
13
+ "registryType": "pypi",
14
+ "identifier": "custovox-visual",
15
+ "version": "1.0.0",
16
+ "transport": {
17
+ "type": "stdio"
18
+ }
19
+ }
20
+ ]
21
+ }
@@ -0,0 +1,102 @@
1
+ from mcp.server.fastmcp import FastMCP
2
+ from transformers import pipeline, BlipProcessor, BlipForConditionalGeneration
3
+ import torch
4
+ import sys
5
+ from PIL import Image
6
+ import requests
7
+ from io import BytesIO
8
+ import base64
9
+
10
+ mcp = FastMCP("custovox-visual")
11
+
12
+ print("Loading visual models...", file=sys.stderr)
13
+ processor = BlipProcessor.from_pretrained("Salesforce/blip-image-captioning-base")
14
+ blip_model = BlipForConditionalGeneration.from_pretrained("Salesforce/blip-image-captioning-base")
15
+ classifier = pipeline(
16
+ "zero-shot-classification",
17
+ model="facebook/bart-large-mnli",
18
+ device=0 if torch.cuda.is_available() else -1
19
+ )
20
+ print("Models loaded.", file=sys.stderr)
21
+
22
+ ISSUE_LABELS = [
23
+ "cleanliness issue", "damage or defect", "missing item",
24
+ "safety concern", "maintenance needed", "poor presentation",
25
+ "incorrect item", "packaging issue", "no visible issue"
26
+ ]
27
+
28
+ HOSPITALITY_LABELS = [
29
+ "room cleanliness problem", "amenities missing", "maintenance issue",
30
+ "bathroom problem", "bed or linen issue", "view or room quality",
31
+ "no visible problem"
32
+ ]
33
+
34
+ def load_image(image_input: str) -> Image.Image:
35
+ if image_input.startswith("http"):
36
+ response = requests.get(image_input, timeout=10)
37
+ response.raise_for_status()
38
+ return Image.open(BytesIO(response.content)).convert("RGB")
39
+ else:
40
+ img_data = base64.b64decode(image_input)
41
+ return Image.open(BytesIO(img_data)).convert("RGB")
42
+
43
+ @mcp.tool()
44
+ def analyze_customer_image(image_url: str, context: str = "general") -> dict:
45
+ """
46
+ Analyze a customer-submitted image for quality issues.
47
+
48
+ Args:
49
+ image_url: URL of the image to analyze, or the image as a base64 string
50
+ context: "hospitality" uses hotel-room labels; any other value uses the general labels
51
+
52
+ Returns:
53
+ description: English caption of the image
54
+ detected_issue: issue category inferred from the caption
55
+ issue_confidence: zero-shot score of that category
56
+ severity: none / low / medium / high (derived from issue_confidence)
57
+ suggested_action: recommended response
58
+ powered_by: custovox.ai
59
+ """
60
+ try:
61
+ image = load_image(image_url)
62
+
63
+ # Generate image description
64
+ inputs = processor(image, return_tensors="pt")
65
+ out = blip_model.generate(**inputs, max_new_tokens=100)
66
+ description = processor.decode(out[0], skip_special_tokens=True)
67
+
68
+ # Classify the issue
69
+ labels = HOSPITALITY_LABELS if context == "hospitality" else ISSUE_LABELS
70
+ issue_result = classifier(description, labels)
71
+
72
+ detected_issue = issue_result["labels"][0]
73
+ confidence = round(issue_result["scores"][0], 3)
74
+
75
+ # Severity
76
+ no_issue = "no visible" in detected_issue.lower()
77
+ if no_issue: severity = "none"
78
+ elif confidence > 0.7: severity = "high"
79
+ elif confidence > 0.4: severity = "medium"
80
+ else: severity = "low"
81
+
82
+ action_map = {
83
+ "none": "No action required — image shows no visible issue",
84
+ "low": "Log for monitoring — no immediate action needed",
85
+ "medium": "Assign to relevant team for review within 48h",
86
+ "high": "Immediate action required — escalate to supervisor"
87
+ }
88
+
89
+ return {
90
+ "description": description,
91
+ "detected_issue": detected_issue,
92
+ "issue_confidence": confidence,
93
+ "severity": severity,
94
+ "suggested_action": action_map[severity],
95
+ "context": context,
96
+ "powered_by": "custovox.ai"
97
+ }
98
+ except Exception as e:
99
+ return {"error": str(e), "powered_by": "custovox.ai"}
100
+
101
+ if __name__ == "__main__":
102
+ mcp.run()