Spaces:
Running
Running
Enhance docstrings in analyze.py for clarity on analysis features, audio info, and response model
Browse files- app/routes/analyze.py +7 -2
app/routes/analyze.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
-
"""
|
| 2 |
-
|
| 3 |
Handles YouTube URLs and file uploads through a unified endpoint.
|
| 4 |
Response format matches platform/hooks/analysisTypes.ts
|
| 5 |
"""
|
|
@@ -27,6 +27,8 @@ preview_model = PreviewModel()
|
|
| 27 |
# ============================================
|
| 28 |
|
| 29 |
class AnalysisFeatures(BaseModel):
|
|
|
|
|
|
|
| 30 |
spectralRegularity: float = 0.5
|
| 31 |
temporalPatterns: float = 0.5
|
| 32 |
harmonicStructure: float = 0.5
|
|
@@ -34,6 +36,8 @@ class AnalysisFeatures(BaseModel):
|
|
| 34 |
|
| 35 |
|
| 36 |
class AudioInfo(BaseModel):
|
|
|
|
|
|
|
| 37 |
duration: float = 0.0
|
| 38 |
sampleRate: int = 44100
|
| 39 |
bitrate: int = 128
|
|
@@ -53,6 +57,7 @@ class AnalysisResult(BaseModel):
|
|
| 53 |
|
| 54 |
|
| 55 |
class AnalyzeResponse(BaseModel):
|
|
|
|
| 56 |
result: Optional[AnalysisResult] = None
|
| 57 |
warnings: List[str] = []
|
| 58 |
errors: List[str] = []
|
|
|
|
| 1 |
+
"""General analysis route for CrownCode.
|
| 2 |
+
|
| 3 |
Handles YouTube URLs and file uploads through a unified endpoint.
|
| 4 |
Response format matches platform/hooks/analysisTypes.ts
|
| 5 |
"""
|
|
|
|
| 27 |
# ============================================
|
| 28 |
|
| 29 |
class AnalysisFeatures(BaseModel):
|
| 30 |
+
"""Audio feature analysis results."""
|
| 31 |
+
|
| 32 |
spectralRegularity: float = 0.5
|
| 33 |
temporalPatterns: float = 0.5
|
| 34 |
harmonicStructure: float = 0.5
|
|
|
|
| 36 |
|
| 37 |
|
| 38 |
class AudioInfo(BaseModel):
|
| 39 |
+
"""Audio file information."""
|
| 40 |
+
|
| 41 |
duration: float = 0.0
|
| 42 |
sampleRate: int = 44100
|
| 43 |
bitrate: int = 128
|
|
|
|
| 57 |
|
| 58 |
|
| 59 |
class AnalyzeResponse(BaseModel):
|
| 60 |
+
"""Response model for analysis endpoint."""
|
| 61 |
result: Optional[AnalysisResult] = None
|
| 62 |
warnings: List[str] = []
|
| 63 |
errors: List[str] = []
|