Spaces:
Running
Running
Commit
·
490c58a
1
Parent(s):
53ac792
error
Browse files
app.py
CHANGED
@@ -73,8 +73,11 @@ def audio_to_bytes(audio: tuple[int, np.ndarray]) -> bytes:
|
|
73 |
|
74 |
|
75 |
def set_api_key(claude_key, play_ht_username, play_ht_key):
|
76 |
-
|
77 |
-
|
|
|
|
|
|
|
78 |
gr.Info("Successfully set API keys.", duration=3)
|
79 |
return Clients(claude=claude_client, play_ht=play_ht_client,
|
80 |
hf=InferenceClient()), gr.skip()
|
|
|
73 |
|
74 |
|
75 |
def set_api_key(claude_key, play_ht_username, play_ht_key):
|
76 |
+
try:
|
77 |
+
claude_client = anthropic.Anthropic(api_key=claude_key)
|
78 |
+
play_ht_client = PyHtClient(user_id=play_ht_username, api_key=play_ht_key)
|
79 |
+
except:
|
80 |
+
gr.Error("Invalid API keys. Please try again.")
|
81 |
gr.Info("Successfully set API keys.", duration=3)
|
82 |
return Clients(claude=claude_client, play_ht=play_ht_client,
|
83 |
hf=InferenceClient()), gr.skip()
|