Spaces:
Sleeping
Sleeping
Commit History
-
Dockerfile
Verified signatureFROM python:3.10-slim WORKDIR /app # Install system dependencies for audio processing RUN apt-get update && apt-get install -y \ libsndfile1 \ ffmpeg \ && rm -rf /var/lib/apt/lists/* # Copy requirements and install Python dependencies COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy application files COPY app.py . # Expose port EXPOSE 7860 # Set environment variables ENV PORT=7860 ENV API_KEY=your-secret-api-key-12345 # Run the application CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--workers", "2", "--timeout", "120", "app:app"]29028c7 -
app.py
Verified signatureimport os import base64 import json import io import numpy as np from flask import Flask, request, jsonify from functools import wraps import librosa import soundfile as sf from scipy import stats from sklearn.preprocessing import StandardScaler import joblib app = Flask(__name__) # API Key for authentication API_KEY = os.environ.get('API_KEY', 'your-secret-api-key-12345') # Authentication decorator def require_api_key(f): @wraps(f) def decorated_function(*args, **kwargs): auth_header = request.headers.get('Authorization') api_key = request.headers.get('X-API-Key') # Check both Authorization and X-API-Key headers provided_key = None if auth_header: if auth_header.startswith('Bearer '): provided_key = auth_header[7:] else: provided_key = auth_header elif api_key: provided_key = api_key if not provided_key or provided_key != API_KEY: …1d1cd52 -
requirements.txt
Verified signatureflask==3.0.0 librosa==0.10.1 soundfile==0.12.1 numpy==1.24.3 scipy==1.11.4 scikit-learn==1.3.2 joblib==1.3.2 gunicorn==21.2.0b7b8d28 -
initial commit
Verified signature6655b50