Spaces:
Running
Running
Sync from GitHub via hub-sync
Browse files- VERSION +1 -1
- docs/github-hf-custom-domain-guide.md +33 -0
VERSION
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
|
|
|
|
| 1 |
+
591b607e9256f858b32b23f79a2badc081ba4a0f
|
docs/github-hf-custom-domain-guide.md
CHANGED
|
@@ -216,3 +216,36 @@ Run through this checklist after initial setup or after any DNS/domain change:
|
|
| 216 |
| TLS certificate "Pending" for >30 min | CNAME not propagated yet or wrong target | Verify CNAME value matches exactly what HF shows |
|
| 217 |
| Custom domain works but assets 404 | `root_path` set to a subpath that doesn't exist | Set `GRADIO_ROOT_PATH=""` or the correct subpath |
|
| 218 |
| Space rebuilds but shows old code | `fetch-depth: 0` missing in workflow | Add `fetch-depth: 0` to `actions/checkout@v4` (see §4) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 216 |
| TLS certificate "Pending" for >30 min | CNAME not propagated yet or wrong target | Verify CNAME value matches exactly what HF shows |
|
| 217 |
| Custom domain works but assets 404 | `root_path` set to a subpath that doesn't exist | Set `GRADIO_ROOT_PATH=""` or the correct subpath |
|
| 218 |
| Space rebuilds but shows old code | `fetch-depth: 0` missing in workflow | Add `fetch-depth: 0` to `actions/checkout@v4` (see §4) |
|
| 219 |
+
| API Error / `ValueError: API key is missing` | Secrets added to GitHub but missing in HF Space | Add API keys directly in HF Space → Settings → Variables and secrets |
|
| 220 |
+
---
|
| 221 |
+
|
| 222 |
+
## 10. Using this Template for AI Projects
|
| 223 |
+
|
| 224 |
+
This repository is designed as a ready-to-use template for future projects, coming with a pre-built **Multi-Provider AI Chat Application** in `main.py`.
|
| 225 |
+
|
| 226 |
+
### Built-in Features
|
| 227 |
+
- **Multi-Provider Backend**: Supports Hugging Face (z.ai), Google Gemini, GitHub Models, OpenRouter, and Fireworks.
|
| 228 |
+
- **Dynamic UI Selection**: Gradio UI dropdowns to select providers and dynamically updated models natively without code edits.
|
| 229 |
+
- **Cost-Optimization Presets**: Select quick presets like **Ultra Cheap**, **Budget Dev**, **Balanced**, and **Quality Check** to auto-configure cost-effective development environments.
|
| 230 |
+
- **Automatic Fallback**: Specify `auto` as the backend to automatically cycle through fallback providers if one fails (configured via `AI_FALLBACK_ORDER`).
|
| 231 |
+
|
| 232 |
+
### Environment Variables
|
| 233 |
+
⚠️ **Important Pitfall:** GitHub Action secrets do **not** automatically sync to Hugging Face Space secrets. While `HF_TOKEN` must be a GitHub Secret for CI/CD, runtime API keys must be added directly to Hugging Face.
|
| 234 |
+
|
| 235 |
+
**1. GitHub Action Secrets (For Sync Only)**
|
| 236 |
+
- `HF_TOKEN`: Hugging Face write token (Required for `hub-sync` to work)
|
| 237 |
+
|
| 238 |
+
**2. Hugging Face Space Secrets (For Runtime)**
|
| 239 |
+
Configure these in your HF Space via **Settings → Variables and secrets**:
|
| 240 |
+
- `HF_TOKEN`: Hugging Face token (if you want the space itself to make authenticated HF API calls)
|
| 241 |
+
- `GOOGLE_API_KEY`: API key for Gemini models
|
| 242 |
+
- `GITHUB_TOKEN`: API key for GitHub Models
|
| 243 |
+
- `OPENROUTER_API_KEY`: API key for OpenRouter
|
| 244 |
+
- `FIREWORKS_API_KEY`: API key for Fireworks
|
| 245 |
+
|
| 246 |
+
*(Note: For local development, you can place these in a `.env` file or export them in your terminal).*
|
| 247 |
+
|
| 248 |
+
You can further customize defaults and available choices by setting:
|
| 249 |
+
- `AI_BACKEND`: Default provider (e.g., `hf`, `google`, `github`, `auto`)
|
| 250 |
+
- `<PROVIDER>_MODEL`: Default model for the provider (e.g., `GOOGLE_MODEL=gemini-2.0-flash-lite`)
|
| 251 |
+
- `<PROVIDER>_MODELS`: Comma-separated list for model dropdown choices (e.g., `GOOGLE_MODELS=gemini-2.0-flash-lite,gemini-1.5-flash`)
|