Skip to content

Commit

Permalink
[DEVX-598]: Get App's Input Count (#372)
Browse files Browse the repository at this point in the history
* [DEVX-598]: Get App's Input Count

* [DEVX-598]: Pre-Commit Changes
  • Loading branch information
srikanthbachala20 authored Aug 22, 2024
1 parent 5a47978 commit 60561c0
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions clarifai/client/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,26 @@ def list_installed_module_versions(self,
yield Module.from_auth_helper(
auth=self.auth_helper, module_id=imv_info['module_version']['module_id'], **imv_info)

def get_input_count(self) -> int:
"""Get count of all the inputs in the app.
Returns:
input_count: count of inputs in the app.
Example:
>>> from clarifai.client.app import App
>>> app = App(app_id="app_id", user_id="user_id")
>>> input_count = app.get_input_count()
"""
request = service_pb2.GetInputCountRequest(user_app_id=self.user_app_id)
response = self._grpc_request(self.STUB.GetInputCount, request)

if response.status.code != status_code_pb2.SUCCESS:
raise Exception(response.status)
self.logger.info("\nGetting App input Counts\n%s", response.status)

return response.counts.processed

def list_concepts(self, page_no: int = None,
per_page: int = None) -> Generator[Concept, None, None]:
"""Lists all the concepts for the app.
Expand Down

0 comments on commit 60561c0

Please sign in to comment.