Skip to content

Commit

Permalink
Add bearer auth support to codegen
Browse files Browse the repository at this point in the history
Signed-off-by: thepetk <[email protected]>
  • Loading branch information
thepetk committed Sep 23, 2024
1 parent dd6c8d6 commit 9af5be0
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@

model_service = os.getenv("MODEL_ENDPOINT", "http://localhost:8001")
model_service = f"{model_service}/v1"
model_service_bearer = os.getenv("MODEL_ENDPOINT_BEARER")
request_kwargs = {}
if model_service_bearer is not None:
request_kwargs = {"headers": {"Authorization": f"Bearer {model_service_bearer}"}}

@st.cache_resource(show_spinner=False)
def checking_model_service():
Expand All @@ -18,7 +22,7 @@ def checking_model_service():
ready = False
while not ready:
try:
request = requests.get(f'{model_service}/models')
request = requests.get(f'{model_service}/models', **request_kwargs)
if request.status_code == 200:
ready = True
except:
Expand Down

0 comments on commit 9af5be0

Please sign in to comment.