Gradio Backend
GradioBackend
Bases: Backend
Gradio backend that handles connections to gradio servers.
Source code in mbodied/agents/backends/gradio_backend.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
|
__init__(endpoint=None, **kwargs)
Initializes the GradioBackend.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
endpoint
|
str
|
The url of the gradio server. |
None
|
**kwargs
|
The keywrod arguments to pass to the gradio client. |
{}
|
Source code in mbodied/agents/backends/gradio_backend.py
24 25 26 27 28 29 30 31 32 33 34 35 36 |
|
predict(*args, **kwargs)
Forward queries to the gradio api endpoint predict
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
*args
|
The arguments to pass to the gradio server. |
()
|
|
**kwargs
|
The keywrod arguments to pass to the gradio server. |
{}
|
Source code in mbodied/agents/backends/gradio_backend.py
38 39 40 41 42 43 44 45 |
|
submit(*args, api_name='/predict', result_callbacks=None, **kwargs)
Submit queries asynchronously without need of asyncio.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
*args
|
The arguments to pass to the gradio server. |
()
|
|
api_name
|
The name of the api endpoint to submit the job. |
'/predict'
|
|
result_callbacks
|
The callbacks to apply to the result. |
None
|
|
**kwargs
|
The keywrod arguments to pass to the gradio server. |
{}
|
Returns:
Name | Type | Description |
---|---|---|
Job |
Job
|
Gradio job object. |
Source code in mbodied/agents/backends/gradio_backend.py
47 48 49 50 51 52 53 54 55 56 57 58 59 |
|