Spaces:
Running on Zero
Running on Zero
Vansh Chugh commited on
Commit ·
c2aac78
1
Parent(s): 448d2f4
format result as text template
Browse files
app.py
CHANGED
|
@@ -135,9 +135,10 @@ def process_fn(audio_path: str) -> str:
|
|
| 135 |
result = inference(audio_path)
|
| 136 |
prediction = result.get("prediction", "Unknown")
|
| 137 |
confidence = result.get("confidence", "0.00")
|
|
|
|
| 138 |
|
| 139 |
with tempfile.NamedTemporaryFile(mode="w", suffix=".txt", delete=False) as f:
|
| 140 |
-
f.write(f"
|
| 141 |
out_path = f.name
|
| 142 |
|
| 143 |
return out_path
|
|
|
|
| 135 |
result = inference(audio_path)
|
| 136 |
prediction = result.get("prediction", "Unknown")
|
| 137 |
confidence = result.get("confidence", "0.00")
|
| 138 |
+
input_name = Path(audio_path).name
|
| 139 |
|
| 140 |
with tempfile.NamedTemporaryFile(mode="w", suffix=".txt", delete=False) as f:
|
| 141 |
+
f.write(f"{input_name}\n\nAI-Detection Results\nPrediction: {prediction} ({confidence}% confidence)\n")
|
| 142 |
out_path = f.name
|
| 143 |
|
| 144 |
return out_path
|