Commit 0f4cf3d
authored
Support kwargs predictors (#2345)
This change allows a predictor input to be defined exclusively as
`**kwargs`. This is an experimental change that allows a model
to be used as a proxy where any inputs will be passed through
directly without modification.
```py
import json
def predict(**kwargs) -> str:
return json.dumps(kwargs)
```
This change restricts the use of `**kwargs` to functions/methods
that accept only that as an argument to avoid the complexity of
having to support both dynamic and fixed inputs.
The OpenAPI schema for such a model will be:
```json
{
"properties": {},
"additionalProperties": true,
"type": "object",
"title": "Input"
}
```1 parent 79a6fa8 commit 0f4cf3d
File tree
4 files changed
+47
-5
lines changed- python
- cog
- tests/server
- fixtures
4 files changed
+47
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
231 | 231 | | |
232 | 232 | | |
233 | 233 | | |
234 | | - | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
235 | 238 | | |
236 | 239 | | |
237 | 240 | | |
238 | 241 | | |
239 | 242 | | |
240 | 243 | | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
241 | 266 | | |
242 | 267 | | |
243 | 268 | | |
| |||
325 | 350 | | |
326 | 351 | | |
327 | 352 | | |
328 | | - | |
329 | | - | |
330 | 353 | | |
331 | 354 | | |
332 | 355 | | |
| |||
431 | 454 | | |
432 | 455 | | |
433 | 456 | | |
434 | | - | |
435 | | - | |
436 | 457 | | |
437 | 458 | | |
438 | 459 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
42 | 54 | | |
43 | 55 | | |
44 | 56 | | |
| |||
0 commit comments