Skip to content

Commit

Permalink
Fix config and ngrok
Browse files Browse the repository at this point in the history
Artrajz committed Mar 21, 2024
1 parent 0a7c027 commit c779041
Showing 2 changed files with 20 additions and 14 deletions.
13 changes: 9 additions & 4 deletions app.py
Original file line number Diff line number Diff line change
@@ -73,9 +73,14 @@ def clean_task():


if __name__ == '__main__':
if not check_is_none(config.ngrok_config.auth_token):
listener = ngrok.forward(config.http_service.port, authtoken=config.ngrok_config.auth_token)

logging.info(f"Ingress established at {listener.url()}")
try:
if not check_is_none(config.ngrok_config.auth_token):
listener = ngrok.forward(config.http_service.port, authtoken=config.ngrok_config.auth_token)

logging.info(f"Ingress established at {listener.url()}")
else:
logging.info(f"Not using ngrok.")
except Exception as e:
logging.error(f"Not using ngrok. Authtoken error:{e}")

app.run(host=config.http_service.host, port=config.http_service.port, debug=config.http_service.debug)
21 changes: 11 additions & 10 deletions config.py
Original file line number Diff line number Diff line change
@@ -90,16 +90,17 @@ def update_config(self, new_config_dict):
nested_config.update_config(new_value)
setattr(self, field_name, nested_config)
else:
if field_type == bool:
new_value = str(new_value).lower() == "true"
elif field_type == int:
new_value = int(new_value)
elif field_type == float:
new_value = float(new_value)
elif field_type == str:
new_value = str(new_value)
elif field_type == torch.device:
new_value = torch.device(new_value)
if new_value is not None:
if field_type == bool:
new_value = str(new_value).lower() == "true"
elif field_type == int:
new_value = int(new_value)
elif field_type == float:
new_value = float(new_value)
elif field_type == str:
new_value = str(new_value)
elif field_type == torch.device:
new_value = torch.device(new_value)

setattr(self, field_name, new_value)

0 comments on commit c779041

Please sign in to comment.