Requirements¶
To use Pinferencia's frontend with your model, there are some requirements of your model's predict function.
Templates¶
Currently, there are mainly two major catogory of the template's inputs and outputs. More (audio and video) will be supported in the future.
Base Templates¶
Template | Input | Output |
---|---|---|
Text to Text | Text | Text |
Text to Image | Text | Image |
Image to Text | Image | Text |
Camera to Text | Image | Text |
Image to Image | Image | Image |
Camera to Image | Image | Image |
Derived Templates¶
Template | Input | Output |
---|---|---|
Translation | Text | Text |
Image Classification | Image | Text |
Image Style Transfer | Image | Image |
Input¶
- The predict function must be able to accept a list of data as inputs.
- For text input, the input will be a list of strings.
- For image input, the input will be a list of strings representing the base64 encoded images.
Output¶
- The predict function must produce a list of data as outputs.
- For text output, the output must be a list.
- For image output, the output must be a list of strings representing the base64 encoded images.
Text Output
The frontend will try to parse the outputs into table, json or pure text.
If the output is similar to below:
[
[
{"a": 1, "b": 2},
{"a": 3, "b": 4},
{"a": 5, "b": 6}
]
]
It will be displayed as a table.
If the output is similar to below:
[
"Text output."
]
It will be displayed as a text.
All other format of outputs will be displayed as a JSON.