Spaces:
Paused
Paused
Commit ·
2276588
1
Parent(s): 5715d51
Update app.py and README.md: Enhance local launch configuration for Docker support and update documentation to include Docker deployment instructions.
Browse files- .dockerignore +42 -0
- Dockerfile +38 -0
- README.md +17 -4
- app.py +6 -2
.dockerignore
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Python
|
| 2 |
+
__pycache__/
|
| 3 |
+
*.py[cod]
|
| 4 |
+
*$py.class
|
| 5 |
+
*.so
|
| 6 |
+
.Python
|
| 7 |
+
env/
|
| 8 |
+
venv/
|
| 9 |
+
ENV/
|
| 10 |
+
.venv
|
| 11 |
+
|
| 12 |
+
# IDE
|
| 13 |
+
.vscode/
|
| 14 |
+
.idea/
|
| 15 |
+
*.swp
|
| 16 |
+
*.swo
|
| 17 |
+
*~
|
| 18 |
+
|
| 19 |
+
# OS
|
| 20 |
+
.DS_Store
|
| 21 |
+
Thumbs.db
|
| 22 |
+
|
| 23 |
+
# Git
|
| 24 |
+
.git/
|
| 25 |
+
.gitignore
|
| 26 |
+
|
| 27 |
+
# Documentation
|
| 28 |
+
*.md
|
| 29 |
+
!README.md
|
| 30 |
+
|
| 31 |
+
# Logs
|
| 32 |
+
*.log
|
| 33 |
+
|
| 34 |
+
# Model cache (will be downloaded in container)
|
| 35 |
+
.cache/
|
| 36 |
+
models/
|
| 37 |
+
|
| 38 |
+
# Test files
|
| 39 |
+
test/
|
| 40 |
+
tests/
|
| 41 |
+
*.test.py
|
| 42 |
+
|
Dockerfile
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use Python 3.10 with CUDA support for GPU acceleration
|
| 2 |
+
FROM python:3.10-slim
|
| 3 |
+
|
| 4 |
+
# Set working directory
|
| 5 |
+
WORKDIR /app
|
| 6 |
+
|
| 7 |
+
# Install system dependencies
|
| 8 |
+
RUN apt-get update && apt-get install -y \
|
| 9 |
+
build-essential \
|
| 10 |
+
git \
|
| 11 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 12 |
+
|
| 13 |
+
# Copy requirements file first for better Docker layer caching
|
| 14 |
+
COPY requirements.txt .
|
| 15 |
+
|
| 16 |
+
# Install PyTorch with CUDA support for GPU acceleration
|
| 17 |
+
# Hugging Face Spaces provides CUDA runtime, so we use CUDA-enabled PyTorch
|
| 18 |
+
RUN pip install --no-cache-dir torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
|
| 19 |
+
|
| 20 |
+
# Install remaining Python dependencies
|
| 21 |
+
# Note: pip will skip torch since it's already installed (satisfies requirements.txt)
|
| 22 |
+
# The git dependency in requirements.txt requires git (already installed above)
|
| 23 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 24 |
+
|
| 25 |
+
# Copy application files
|
| 26 |
+
COPY app.py .
|
| 27 |
+
COPY README.md .
|
| 28 |
+
|
| 29 |
+
# Expose Gradio default port
|
| 30 |
+
EXPOSE 7860
|
| 31 |
+
|
| 32 |
+
# Set environment variables
|
| 33 |
+
ENV GRADIO_SERVER_NAME=0.0.0.0
|
| 34 |
+
ENV GRADIO_SERVER_PORT=7860
|
| 35 |
+
|
| 36 |
+
# Run the application
|
| 37 |
+
CMD ["python", "app.py"]
|
| 38 |
+
|
README.md
CHANGED
|
@@ -3,9 +3,7 @@ title: Stable Audio Open
|
|
| 3 |
emoji: 🎵
|
| 4 |
colorFrom: blue
|
| 5 |
colorTo: purple
|
| 6 |
-
sdk:
|
| 7 |
-
sdk_version: 6.2.0
|
| 8 |
-
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
---
|
| 11 |
|
|
@@ -38,10 +36,25 @@ An open-source web interface for generating high-quality audio from text prompts
|
|
| 38 |
## Technical Details
|
| 39 |
|
| 40 |
This application uses:
|
|
|
|
| 41 |
- **Gradio** for the web interface
|
| 42 |
-
- **PyTorch** and **
|
| 43 |
- **Stable Audio** technology for high-quality audio generation
|
| 44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
## Contributing
|
| 46 |
|
| 47 |
This is an open-source project. Contributions are welcome! Feel free to:
|
|
|
|
| 3 |
emoji: 🎵
|
| 4 |
colorFrom: blue
|
| 5 |
colorTo: purple
|
| 6 |
+
sdk: docker
|
|
|
|
|
|
|
| 7 |
pinned: false
|
| 8 |
---
|
| 9 |
|
|
|
|
| 36 |
## Technical Details
|
| 37 |
|
| 38 |
This application uses:
|
| 39 |
+
- **Docker** for containerized deployment
|
| 40 |
- **Gradio** for the web interface
|
| 41 |
+
- **PyTorch** (with CUDA support) and **Diffusers** for AI model integration
|
| 42 |
- **Stable Audio** technology for high-quality audio generation
|
| 43 |
|
| 44 |
+
## Docker Deployment
|
| 45 |
+
|
| 46 |
+
This Space is containerized using Docker. The Dockerfile includes:
|
| 47 |
+
- Python 3.10 base image
|
| 48 |
+
- CUDA-enabled PyTorch for GPU acceleration
|
| 49 |
+
- All required dependencies from `requirements.txt`
|
| 50 |
+
- Optimized for GPU inference
|
| 51 |
+
|
| 52 |
+
To build and run locally:
|
| 53 |
+
```bash
|
| 54 |
+
docker build -t stable-audio-open .
|
| 55 |
+
docker run -p 7860:7860 --gpus all stable-audio-open
|
| 56 |
+
```
|
| 57 |
+
|
| 58 |
## Contributing
|
| 59 |
|
| 60 |
This is an open-source project. Contributions are welcome! Feel free to:
|
app.py
CHANGED
|
@@ -185,6 +185,10 @@ def create_audio_generation_interface():
|
|
| 185 |
# Create the Gradio interface for Spaces
|
| 186 |
demo = create_audio_generation_interface()
|
| 187 |
|
| 188 |
-
# Launch the interface for local development
|
| 189 |
if __name__ == "__main__":
|
| 190 |
-
demo.launch(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 185 |
# Create the Gradio interface for Spaces
|
| 186 |
demo = create_audio_generation_interface()
|
| 187 |
|
| 188 |
+
# Launch the interface for local development and Docker
|
| 189 |
if __name__ == "__main__":
|
| 190 |
+
demo.launch(
|
| 191 |
+
theme=gr.themes.Soft(),
|
| 192 |
+
server_name="0.0.0.0", # Allow external connections (required for Docker)
|
| 193 |
+
server_port=7860
|
| 194 |
+
)
|