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.
- package/README.md +44 -9
- 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
|
-
##
|
|
141
|
+
## Backend Integration
|
|
142
142
|
|
|
143
|
-
This package
|
|
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
|
-
|
|
145
|
+
We offer a public demo server for testing. Set API endpoint as:
|
|
147
146
|
|
|
148
147
|
```bash
|
|
149
|
-
|
|
150
|
-
|
|
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
|
-
|
|
153
|
-
|
|
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
|
-
>
|
|
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