MCPcopy Create free account
hub / github.com/Paper2Poster/Paper2Poster / run_async

Function run_async

utils/src/llms.py:25–41  ·  view source on GitHub ↗

Run an asynchronous coroutine in a non-async environment. Args: coroutine: The coroutine to run. Returns: The result of the coroutine.

(coroutine)

Source from the content-addressed store, hash-verified

23
24
25def run_async(coroutine):
26 """
27 Run an asynchronous coroutine in a non-async environment.
28
29 Args:
30 coroutine: The coroutine to run.
31
32 Returns:
33 The result of the coroutine.
34 """
35 try:
36 loop = asyncio.get_event_loop()
37 except RuntimeError:
38 loop = asyncio.new_event_loop()
39 asyncio.set_event_loop(loop)
40 job = loop.run_until_complete(coroutine)
41 return job
42
43
44def calc_image_tokens(images: list[str]):

Callers 2

__call__Method · 0.70
get_batch_resultMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected