react-a11y-auto-caption 1.1.3 → 1.1.5

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.
Files changed (2) hide show
  1. package/README.md +44 -9
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -138,23 +138,58 @@ if (error) return <p>Failed to generate caption.</p>;
138
138
 
139
139
  ---
140
140
 
141
- ## Security & Backend Integration
141
+ ## Backend Integration
142
142
 
143
- This package requires a backend to process images through an AI model (e.g. ViT-GPT2). <br/>
144
- We provide a ready-to-use FastAPI reference server in [this repository](https://github.com/kong33/SmartImage).
143
+ This package needs a caption API endpoint to generate alt text.
145
144
 
146
- For security, all cross-origin requests are blocked by default. Set the `ALLOWED_ORIGINS` environment variable in your server's `.env` file:
145
+ We offer a public demo server for testing. Set API endpoint as:
147
146
 
148
147
  ```bash
149
- # Production
150
- ALLOWED_ORIGINS=https://your-frontend-domain.com
148
+ https://kong3333-react-a11y-auto-caption-server.hf.space/api/generate-caption
149
+ ```
150
+
151
+ > This public demo server is for testing only and may be slow or unavailable depending on free-tier limits.
152
+ > For production, please run your own caption server.
153
+
154
+ The easiest way is to run the official local server:
155
+
156
+ ```bash
157
+ npx react-a11y-auto-caption-server
158
+ ```
151
159
 
152
- # Local development
153
- ALLOWED_ORIGINS=http://localhost:3000
160
+ By default, the server runs at:
161
+
162
+ ```txt
163
+ http://127.0.0.1:8000/api/generate-caption
164
+ ```
165
+
166
+ Use it with `SmartImage` or `SmartNextImage`:
167
+
168
+ ```tsx
169
+ <SmartImage
170
+ src="/example.jpg"
171
+ apiEndpoint="http://127.0.0.1:8000/api/generate-caption"
172
+ />
173
+ ```
174
+
175
+ You can also change the port:
176
+
177
+ ```bash
178
+ npx react-a11y-auto-caption-server --port 5000
179
+ ```
180
+
181
+ Then update the endpoint:
182
+
183
+ ```tsx
184
+ <SmartImage
185
+ src="/example.jpg"
186
+ apiEndpoint="http://127.0.0.1:5000/api/generate-caption"
187
+ />
154
188
  ```
155
189
 
156
- > **Note:** Separate multiple origins with a comma and no spaces. Adjust the port if using Vite (`5173`) or another local server.
190
+ > First run may take a few minutes because the server creates a Python environment and installs AI dependencies.
157
191
 
192
+ For production, we recommend running your own caption server and applying CORS restrictions, file size limits, and rate limiting.
158
193
 
159
194
  ---
160
195
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-a11y-auto-caption",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
4
4
  "description": "Smart React component that automatically generates alt text for images using AI.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",