#!/bin/bash
echo "=== ACE-Step Speed Test ==="
echo "Starting generation: 10s audio, 15 steps..."
START=$(date +%s)

curl -s -X POST http://localhost:8076/generate \
  -H "Content-Type: application/json" \
  -d '{"prompt":"upbeat electronic dance music","lyrics":"[verse]\nLa la la\n[chorus]\nDance all night","duration":10,"ace_steps":15,"cfg_scale":5.0,"seed":42}' \
  -o /tmp/ace_result.json

END=$(date +%s)
ELAPSED=$((END - START))

echo "Total time: ${ELAPSED}s"
echo ""
echo "Response keys:"
python3 -c "import json; d=json.load(open('/tmp/ace_result.json')); print('Keys:', list(d.keys())); print('Duration field:', d.get('duration_seconds','N/A')); print('Steps:', d.get('ace_steps','N/A'))" 2>/dev/null || echo "Could not parse JSON response"

echo ""
echo "Container logs (last 10 lines):"
docker logs ace-step --tail 10 2>&1
