Spaces:
Runtime error
Runtime error
chore: try default key
Browse files
app.py
CHANGED
@@ -9,6 +9,7 @@ from dataclasses import dataclass, field
|
|
9 |
from threading import Lock
|
10 |
import base64
|
11 |
import uuid
|
|
|
12 |
|
13 |
|
14 |
@dataclass
|
@@ -162,10 +163,8 @@ def response(state: AppState):
|
|
162 |
|
163 |
|
164 |
def set_api_key(api_key, state):
|
165 |
-
if not api_key:
|
166 |
-
raise gr.Error("Please enter a valid API key.")
|
167 |
try:
|
168 |
-
state.client = create_client(
|
169 |
return gr.update(value="API key set successfully!", visible=True), state
|
170 |
except Exception as e:
|
171 |
return gr.update(value="Connection error", visible=True), state
|
|
|
9 |
from threading import Lock
|
10 |
import base64
|
11 |
import uuid
|
12 |
+
import os
|
13 |
|
14 |
|
15 |
@dataclass
|
|
|
163 |
|
164 |
|
165 |
def set_api_key(api_key, state):
|
|
|
|
|
166 |
try:
|
167 |
+
state.client = create_client(os.getenv("API_KEY"))
|
168 |
return gr.update(value="API key set successfully!", visible=True), state
|
169 |
except Exception as e:
|
170 |
return gr.update(value="Connection error", visible=True), state
|