Spaces:
Sleeping
Sleeping
Commit
·
ad39e05
1
Parent(s):
5cfd2e1
Add GitHub Actions CI/CD for Modal deployment
Browse files- Fix Modal ASGI app serving with
@modal
.concurrent
- Add .github/workflows/deploy.yml for auto-deploy on push to main
- Requires MODAL_TOKEN_ID and MODAL_TOKEN_SECRET secrets
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- .github/workflows/deploy.yml +32 -0
- modal_app.py +4 -3
.github/workflows/deploy.yml
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Deploy to Modal
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
push:
|
| 5 |
+
branches:
|
| 6 |
+
- main
|
| 7 |
+
|
| 8 |
+
jobs:
|
| 9 |
+
deploy:
|
| 10 |
+
name: Deploy
|
| 11 |
+
runs-on: ubuntu-latest
|
| 12 |
+
env:
|
| 13 |
+
MODAL_TOKEN_ID: ${{ secrets.MODAL_TOKEN_ID }}
|
| 14 |
+
MODAL_TOKEN_SECRET: ${{ secrets.MODAL_TOKEN_SECRET }}
|
| 15 |
+
|
| 16 |
+
steps:
|
| 17 |
+
- name: Checkout Repository
|
| 18 |
+
uses: actions/checkout@v4
|
| 19 |
+
|
| 20 |
+
- name: Install Python
|
| 21 |
+
uses: actions/setup-python@v5
|
| 22 |
+
with:
|
| 23 |
+
python-version: "3.11"
|
| 24 |
+
|
| 25 |
+
- name: Install Modal
|
| 26 |
+
run: |
|
| 27 |
+
python -m pip install --upgrade pip
|
| 28 |
+
pip install modal
|
| 29 |
+
|
| 30 |
+
- name: Deploy to Modal
|
| 31 |
+
run: |
|
| 32 |
+
modal deploy modal_app.py
|
modal_app.py
CHANGED
|
@@ -31,15 +31,16 @@ image = (
|
|
| 31 |
modal.Secret.from_name("elevenlabs-api-key"),
|
| 32 |
],
|
| 33 |
timeout=600,
|
| 34 |
-
allow_concurrent_inputs=10,
|
| 35 |
)
|
|
|
|
| 36 |
@modal.asgi_app()
|
| 37 |
def serve():
|
| 38 |
-
"""Serve the Gradio app."""
|
| 39 |
import sys
|
| 40 |
sys.path.insert(0, "/app")
|
| 41 |
|
| 42 |
-
from app import
|
|
|
|
| 43 |
return gradio_app
|
| 44 |
|
| 45 |
|
|
|
|
| 31 |
modal.Secret.from_name("elevenlabs-api-key"),
|
| 32 |
],
|
| 33 |
timeout=600,
|
|
|
|
| 34 |
)
|
| 35 |
+
@modal.concurrent(max_inputs=100)
|
| 36 |
@modal.asgi_app()
|
| 37 |
def serve():
|
| 38 |
+
"""Serve the Gradio app as ASGI."""
|
| 39 |
import sys
|
| 40 |
sys.path.insert(0, "/app")
|
| 41 |
|
| 42 |
+
from app import create_app
|
| 43 |
+
gradio_app = create_app()
|
| 44 |
return gradio_app
|
| 45 |
|
| 46 |
|