Spaces:
Runtime error
Runtime error
Update environment example and Dockerfile health check
Browse files- Changed HF_TOKEN placeholder in env-example.txt for better clarity.
- Updated health check command in Dockerfile to verify server response correctly.
- Adjusted parameter name in app.py for audio generation to align with model requirements.
- Dockerfile +1 -3
- app.py +2 -2
Dockerfile
CHANGED
|
@@ -56,10 +56,8 @@ EXPOSE 7860
|
|
| 56 |
# Health check - verify Gradio server is responding
|
| 57 |
# Extended start-period to allow model download and initialization
|
| 58 |
HEALTHCHECK --interval=30s --timeout=15s --start-period=300s --retries=5 \
|
| 59 |
-
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:7860/
|
| 60 |
|
| 61 |
-
# Add a simple health endpoint for better monitoring
|
| 62 |
-
RUN echo 'import os; os.system("python -c \"print(\\\"OK\\\")\" > /tmp/healthz.txt")' >> /app/health_check.py
|
| 63 |
|
| 64 |
# Run the application with proper resource management
|
| 65 |
CMD ["python", "-u", "app.py"]
|
|
|
|
| 56 |
# Health check - verify Gradio server is responding
|
| 57 |
# Extended start-period to allow model download and initialization
|
| 58 |
HEALTHCHECK --interval=30s --timeout=15s --start-period=300s --retries=5 \
|
| 59 |
+
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:7860/')" 2>/dev/null || exit 1
|
| 60 |
|
|
|
|
|
|
|
| 61 |
|
| 62 |
# Run the application with proper resource management
|
| 63 |
CMD ["python", "-u", "app.py"]
|
app.py
CHANGED
|
@@ -136,11 +136,11 @@ def generate_audio_with_model(prompt, duration, seed):
|
|
| 136 |
)
|
| 137 |
except TypeError as e1:
|
| 138 |
try:
|
| 139 |
-
# Try alternative parameter name
|
| 140 |
output = pipeline(
|
| 141 |
prompt=prompt,
|
| 142 |
num_inference_steps=50,
|
| 143 |
-
|
| 144 |
guidance_scale=3.5, # Add guidance for better quality
|
| 145 |
generator=generator,
|
| 146 |
)
|
|
|
|
| 136 |
)
|
| 137 |
except TypeError as e1:
|
| 138 |
try:
|
| 139 |
+
# Try alternative parameter name (some models use 'duration' instead of 'audio_length_in_s')
|
| 140 |
output = pipeline(
|
| 141 |
prompt=prompt,
|
| 142 |
num_inference_steps=50,
|
| 143 |
+
duration=audio_duration,
|
| 144 |
guidance_scale=3.5, # Add guidance for better quality
|
| 145 |
generator=generator,
|
| 146 |
)
|