knox revisó este gist . Ir a la revisión
1 file changed, 14 insertions
Jina-16.py(archivo creado)
@@ -0,0 +1,14 @@ | |||
1 | + | # Server | |
2 | + | with Deployment(uses=TokenStreamingExecutor, port=12345, protocol='grpc') as dep: | |
3 | + | dep.block() | |
4 | + | ||
5 | + | ||
6 | + | # Client | |
7 | + | async def main(): | |
8 | + | client = Client(port=12345, protocol='grpc', asyncio=True) | |
9 | + | async for doc in client.stream_doc( | |
10 | + | on='/stream', | |
11 | + | inputs=PromptDocument(prompt='what is the capital of France ?', max_tokens=10), | |
12 | + | return_type=ModelOutputDocument, | |
13 | + | ): | |
14 | + | print(doc.generated_text) |
Siguiente
Anterior