#!/usr/bin/env bash set -e DIR="$(cd "$(dirname "$0")" && pwd)" cd "$DIR" # Activate virtual environment source .venv/bin/activate echo "╔══════════════════════════════════════════════════════════════╗" echo "║ Supertonic 3 — Avvio Servizi ║" echo "╠══════════════════════════════════════════════════════════════╣" echo "║ ║" echo "║ [B] Demo Gradio: http://127.0.0.1:7860 ║" echo "║ [C] Server HTTP: http://127.0.0.1:7788/docs ║" echo "║ ║" echo "╚══════════════════════════════════════════════════════════════╝" echo "" # Export vars to suppress ONNX affinity warnings (harmless in containers) export ORT_DISABLE_CPU_THREAD_AFFINITY=1 # Start HTTP server in background (C) echo "→ Avvio server HTTP (supertonic serve) sulla porta 7788..." supertonic serve --host 127.0.0.1 --port 7788 & HTTP_PID=$! # Start Gradio demo in background (B) echo "→ Avvio demo Gradio sulla porta 7860..." python app.py & GRADIO_PID=$! echo "" echo "Premi Ctrl+C per fermare entrambi i servizi." echo "" # Trap to kill both on exit cleanup() { echo "" echo "→ Fermo servizi..." kill "$HTTP_PID" "$GRADIO_PID" 2>/dev/null wait echo "✓ Servizi fermati." } trap cleanup EXIT INT TERM # Wait for both wait