Remove debug messages from API initialization
Browse files
app.py
CHANGED
@@ -18,18 +18,14 @@ def get_api_key():
|
|
18 |
# Try getting from Streamlit secrets first (for Hugging Face deployment)
|
19 |
try:
|
20 |
if hasattr(st.secrets, "anthropic_key"):
|
21 |
-
st.write("Debug: Found key in Streamlit secrets")
|
22 |
return st.secrets.anthropic_key
|
23 |
except Exception as e:
|
24 |
-
|
25 |
|
26 |
# Fall back to environment variable (for local development)
|
27 |
env_key = os.getenv("ANTHROPIC_API_KEY")
|
28 |
if env_key:
|
29 |
-
st.write("Debug: Found key in environment variables")
|
30 |
return env_key
|
31 |
-
else:
|
32 |
-
st.write("Debug: No key found in environment variables")
|
33 |
|
34 |
return None
|
35 |
|
@@ -47,7 +43,6 @@ try:
|
|
47 |
|
48 |
# Initialize client with API key from environment
|
49 |
client = Anthropic(api_key=api_key)
|
50 |
-
st.write("Debug: Successfully created Anthropic client")
|
51 |
|
52 |
except Exception as e:
|
53 |
st.error(f"Failed to configure Anthropic client: {e}")
|
|
|
18 |
# Try getting from Streamlit secrets first (for Hugging Face deployment)
|
19 |
try:
|
20 |
if hasattr(st.secrets, "anthropic_key"):
|
|
|
21 |
return st.secrets.anthropic_key
|
22 |
except Exception as e:
|
23 |
+
pass
|
24 |
|
25 |
# Fall back to environment variable (for local development)
|
26 |
env_key = os.getenv("ANTHROPIC_API_KEY")
|
27 |
if env_key:
|
|
|
28 |
return env_key
|
|
|
|
|
29 |
|
30 |
return None
|
31 |
|
|
|
43 |
|
44 |
# Initialize client with API key from environment
|
45 |
client = Anthropic(api_key=api_key)
|
|
|
46 |
|
47 |
except Exception as e:
|
48 |
st.error(f"Failed to configure Anthropic client: {e}")
|