Spaces:
Sleeping
Sleeping
Nikita Makarov
commited on
Commit
·
2fe88e9
1
Parent(s):
248f723
Remove hardcoded API keys, use environment variables only
Browse files- All API keys now read from environment variables (secrets in HF Spaces)
- Removed hardcoded keys from config.py
- Added SECRETS_SETUP.md with detailed instructions
- Updated app.py for HF Spaces compatibility
- Updated README_HF_SPACES.md with secrets setup guide
- README_HF_SPACES.md +11 -5
- app.py +2 -5
README_HF_SPACES.md
CHANGED
|
@@ -9,11 +9,17 @@ This is the deployment guide for hosting AI Radio on HuggingFace Spaces.
|
|
| 9 |
- Set the hardware to "CPU" (or "GPU" if available)
|
| 10 |
|
| 11 |
2. **Configure Secrets** in your Space settings:
|
| 12 |
-
Go to Settings → Secrets and add the following:
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
- `
|
| 16 |
-
- `
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
3. **Push your code** to the Space repository
|
| 19 |
|
|
|
|
| 9 |
- Set the hardware to "CPU" (or "GPU" if available)
|
| 10 |
|
| 11 |
2. **Configure Secrets** in your Space settings:
|
| 12 |
+
Go to **Settings → Secrets** and add the following:
|
| 13 |
+
|
| 14 |
+
**Required Secrets:**
|
| 15 |
+
- `ELEVENLABS_API_KEY` - Your ElevenLabs API key (for text-to-speech)
|
| 16 |
+
- `NEBIUS_API_KEY` - Your Nebius API key (for GPT-OSS-120B LLM)
|
| 17 |
+
|
| 18 |
+
**Optional Secrets:**
|
| 19 |
+
- `LLAMAINDEX_API_KEY` - Your LlamaIndex API key (for embeddings, fallback to local)
|
| 20 |
+
- `OPENAI_API_KEY` - OpenAI API key (for embeddings fallback, optional)
|
| 21 |
+
|
| 22 |
+
📖 **Detailed instructions:** See `SECRETS_SETUP.md` for step-by-step guide
|
| 23 |
|
| 24 |
3. **Push your code** to the Space repository
|
| 25 |
|
app.py
CHANGED
|
@@ -10,9 +10,6 @@ sys.path.insert(0, os.path.join(os.path.dirname(__file__), "src"))
|
|
| 10 |
from app import demo
|
| 11 |
|
| 12 |
if __name__ == "__main__":
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
server_port=7860, # HF Spaces default port
|
| 16 |
-
share=False
|
| 17 |
-
)
|
| 18 |
|
|
|
|
| 10 |
from app import demo
|
| 11 |
|
| 12 |
if __name__ == "__main__":
|
| 13 |
+
# HF Spaces automatically handles server_name and server_port
|
| 14 |
+
demo.launch()
|
|
|
|
|
|
|
|
|
|
| 15 |
|