Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -32,10 +32,19 @@ def load_model():
|
|
| 32 |
with st.spinner("Loading transformer model..."):
|
| 33 |
model = load_model()
|
| 34 |
|
| 35 |
-
#
|
|
|
|
|
|
|
|
|
|
| 36 |
with st.sidebar:
|
| 37 |
st.header("⚙️ Configuration")
|
| 38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
|
| 40 |
st.markdown("---")
|
| 41 |
st.markdown("""
|
|
|
|
| 32 |
with st.spinner("Loading transformer model..."):
|
| 33 |
model = load_model()
|
| 34 |
|
| 35 |
+
# Get API key from environment variables (Hugging Face Spaces secrets)
|
| 36 |
+
api_key = os.getenv("OPENROUTER_API_KEY")
|
| 37 |
+
|
| 38 |
+
# Sidebar for configuration
|
| 39 |
with st.sidebar:
|
| 40 |
st.header("⚙️ Configuration")
|
| 41 |
+
|
| 42 |
+
if api_key:
|
| 43 |
+
st.success("✅ API Key loaded from environment")
|
| 44 |
+
else:
|
| 45 |
+
st.error("❌ API Key not found in environment")
|
| 46 |
+
api_key = st.text_input("OpenRouter API Key", type="password", help="Get your API key from https://openrouter.ai/keys")
|
| 47 |
+
st.info("💡 Tip: Set OPENROUTER_API_KEY in Hugging Face Spaces secrets to avoid typing it every time")
|
| 48 |
|
| 49 |
st.markdown("---")
|
| 50 |
st.markdown("""
|