Spaces:
Sleeping
Sleeping
ranar110 commited on
Commit ·
d9d5e33
1
Parent(s): 4f7e968
Compliance: Flatten response to include top-level 'classification' and 'confidence'
Browse files
main.py
CHANGED
|
@@ -14,6 +14,8 @@ app.mount("/static", StaticFiles(directory=os.path.join(os.getcwd(), "static")),
|
|
| 14 |
|
| 15 |
class AnalysisResponse(BaseModel):
|
| 16 |
status: str
|
|
|
|
|
|
|
| 17 |
analysis: dict
|
| 18 |
metadata: dict
|
| 19 |
|
|
@@ -96,11 +98,14 @@ async def detect_voice(
|
|
| 96 |
# Process Audio (get metadata)
|
| 97 |
metadata = await process_audio(file, audio_url)
|
| 98 |
|
|
|
|
| 99 |
# Run Detection
|
| 100 |
result = analyze_audio(metadata)
|
| 101 |
|
| 102 |
return {
|
| 103 |
"status": "success",
|
|
|
|
|
|
|
| 104 |
"analysis": result,
|
| 105 |
"metadata": metadata
|
| 106 |
}
|
|
|
|
| 14 |
|
| 15 |
class AnalysisResponse(BaseModel):
|
| 16 |
status: str
|
| 17 |
+
classification: Optional[str] = None
|
| 18 |
+
confidence: Optional[float] = None
|
| 19 |
analysis: dict
|
| 20 |
metadata: dict
|
| 21 |
|
|
|
|
| 98 |
# Process Audio (get metadata)
|
| 99 |
metadata = await process_audio(file, audio_url)
|
| 100 |
|
| 101 |
+
# Run Detection
|
| 102 |
# Run Detection
|
| 103 |
result = analyze_audio(metadata)
|
| 104 |
|
| 105 |
return {
|
| 106 |
"status": "success",
|
| 107 |
+
"classification": result.get("classification"),
|
| 108 |
+
"confidence": result.get("confidence"),
|
| 109 |
"analysis": result,
|
| 110 |
"metadata": metadata
|
| 111 |
}
|