Skip to content

Commit

Permalink
Use app url if no registry github url (#3682)
Browse files Browse the repository at this point in the history
  • Loading branch information
npentrel authored Nov 18, 2024
1 parent c31ff39 commit 566ba0a
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/get_modular_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@ async def connect() -> ViamClient:
)
return await ViamClient.create_from_dial_options(dial_options)

# ModelType is an enum and defined to render as int, convert back to string through this
# ModelType is an enum and defined to render as int, convert back to string through this
def model_type_to_str(model_type: int) -> str:
model_type_map = {
0: "Unspecified",
1: "Single Label Classification",
2: "Multi Label Classification",
3: "Object Detection",
}

try:
return model_type_map[model_type]
except KeyError:
raise ValueError(f"NEW UNKNOWN MODEL TYPE {model_type} must add to model type map")

def model_framework_to_str(model_framework: int) -> str:
model_framework_map = {
0: "Unspecified",
Expand All @@ -40,7 +40,7 @@ def model_framework_to_str(model_framework: int) -> str:
3: "Pytorch",
4: "ONNX"
}

try:
return model_framework_map[model_framework]
except KeyError:
Expand Down Expand Up @@ -70,12 +70,14 @@ async def main():
for module in module_list:
if module.visibility == 2:
for model in module.models:
app_url = "https://app.viam.com/module/" + module.public_namespace + "/" + module.name + "/"
json_m = {
"id": module.module_id + '-' + model.model,
"module_id": module.module_id,
"total_organization_usage": module.total_organization_usage,
"total_robot_usage": module.total_robot_usage,
"url": module.url,
"url": module.url or app_url,
"app_url": app_url,
"description": module.description,
"model": model.model,
"api": model.api,
Expand Down

0 comments on commit 566ba0a

Please sign in to comment.