-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support gradio client with modelz endpoints (#37)
* feat: support gradio client with modelz endpoints Signed-off-by: Kaiyang-Chen <kaiyang-chen@sjtu.edu.cn> * doc: gradio client Signed-off-by: Kaiyang-Chen <kaiyang-chen@sjtu.edu.cn> * doc Signed-off-by: Kaiyang-Chen <kaiyang-chen@sjtu.edu.cn> --------- Signed-off-by: Kaiyang-Chen <kaiyang-chen@sjtu.edu.cn>
- Loading branch information
1 parent
6864aec
commit 9e41a37
Showing
5 changed files
with
612 additions
and
339 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
from .client import ModelzClient | ||
from .gradio_client import GradioClient | ||
|
||
__all__ = [ | ||
"ModelzClient", | ||
"GradioClient", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from gradio_client import Client | ||
|
||
from modelz.env import EnvConfig | ||
|
||
config = EnvConfig() | ||
|
||
|
||
class GradioClient: | ||
"""Create a Gradio Client with Modelz endpoints. | ||
Args: | ||
host: Modelz host address | ||
""" | ||
|
||
def __init__( | ||
self, | ||
host: str = None, | ||
) -> None: | ||
self.host = host if host else config.host | ||
self._client = Client(self.host) | ||
|
||
def __getattr__(self, attr): | ||
"""Delegate access to implement the composition.""" | ||
return getattr(self._client, attr) |
Oops, something went wrong.