added support for additional more user-friendly interfaces, improved some part of the application loading process to make it a bit simpler

This commit is contained in:
faraphel 2025-01-12 12:52:19 +01:00
parent 1a49aa3779
commit f647c960dd
20 changed files with 353 additions and 107 deletions

View file

@ -2,10 +2,14 @@
"type": "python",
"tags": ["dummy"],
"file": "model.py",
"interface": "chat",
"output_type": "video/mp4",
"summary": "Echo model",
"description": "The most basic example model, simply echo the input",
"inputs": {
"file": {"type": "file"}
}
"messages": {"type": "list[dict]", "default": "[{\"role\": \"user\", \"content\": \"who are you ?\"}]"}
},
"output_type": "text/markdown"
}

View file

@ -7,5 +7,5 @@ def load(model) -> None:
def unload(model) -> None:
pass
async def infer(model, file) -> typing.AsyncIterator[bytes]:
yield await file.read()
async def infer(model, messages: list[dict]) -> typing.AsyncIterator[bytes]:
yield messages[-1]["content"].encode("utf-8")