Update app.py
Browse files
app.py
CHANGED
@@ -96,14 +96,14 @@ async def run_samba_api_inference(query, system_prompt = None, ignore_context=Fa
|
|
96 |
except requests.exceptions.HTTPError as e:
|
97 |
if post_response.status_code in {401, 503}:
|
98 |
st.info(f"Invalid Key! Please make sure you have a valid SambaCloud key from https://cloud.sambanova.ai/.")
|
99 |
-
return ""
|
100 |
if post_response.status_code in {429, 504}:
|
101 |
st.info("Rate limit hit because of all the pipelined queries, wait one second...")
|
102 |
await asyncio.sleep(num_seconds_to_sleep)
|
103 |
return await run_samba_api_inference(query) # Retry the request
|
104 |
else:
|
105 |
print(f"Request failed with status code: {post_response.status_code}. Error: {e}")
|
106 |
-
return ""
|
107 |
|
108 |
response_data = json.loads(post_response.text)
|
109 |
|
@@ -279,7 +279,7 @@ def handle_userinput(user_question: Optional[str]) -> None:
|
|
279 |
):
|
280 |
with st.chat_message('user'):
|
281 |
st.write(f'{ques}')
|
282 |
-
|
283 |
with st.chat_message(
|
284 |
'ai',
|
285 |
avatar='https://sambanova.ai/hubfs/logotype_sambanova_orange.png',
|
|
|
96 |
except requests.exceptions.HTTPError as e:
|
97 |
if post_response.status_code in {401, 503}:
|
98 |
st.info(f"Invalid Key! Please make sure you have a valid SambaCloud key from https://cloud.sambanova.ai/.")
|
99 |
+
return "Invalid Key! Please make sure you have a valid SambaCloud key from https://cloud.sambanova.ai/."
|
100 |
if post_response.status_code in {429, 504}:
|
101 |
st.info("Rate limit hit because of all the pipelined queries, wait one second...")
|
102 |
await asyncio.sleep(num_seconds_to_sleep)
|
103 |
return await run_samba_api_inference(query) # Retry the request
|
104 |
else:
|
105 |
print(f"Request failed with status code: {post_response.status_code}. Error: {e}")
|
106 |
+
return "Invalid Key! Please make sure you have a valid SambaCloud key from https://cloud.sambanova.ai/."
|
107 |
|
108 |
response_data = json.loads(post_response.text)
|
109 |
|
|
|
279 |
):
|
280 |
with st.chat_message('user'):
|
281 |
st.write(f'{ques}')
|
282 |
+
|
283 |
with st.chat_message(
|
284 |
'ai',
|
285 |
avatar='https://sambanova.ai/hubfs/logotype_sambanova_orange.png',
|