my uvicorn is having problems with my setup for some reason I'll provide all files and the errors so you have a full understanding, if you need to fix anything reply the full scripts fixed.

'my c# class'
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;

public class AceStepMusicGen
{
    private readonly HttpClient _httpClient;
    private readonly string _baseUrl;

    public AceStepMusicGen(string baseUrl = "http://localhost:8000")
    {
        _baseUrl = baseUrl?.TrimEnd('/');
        _httpClient = new HttpClient();
    }

    // Request model matching ACEStepInput in Python
    public class ACEStepInput
    {
        public float AudioDuration { get; set; }
        public string Prompt { get; set; }
        public string Lyrics { get; set; }
        public int InferStep { get; set; }
        public float GuidanceScale { get; set; }
        public string SchedulerType { get; set; }
        public string CfgType { get; set; }
        public float OmegaScale { get; set; }
        public List<int> ActualSeeds { get; set; }
        public float GuidanceInterval { get; set; }
        public float GuidanceIntervalDecay { get; set; }
        public float MinGuidanceScale { get; set; }
        public bool UseErgTag { get; set; }
        public bool UseErgLyric { get; set; }
        public bool UseErgDiffusion { get; set; }
        public List<int> OssSteps { get; set; }
        public float GuidanceScaleText { get; set; } = 0.0f;
        public float GuidanceScaleLyric { get; set; } = 0.0f;
    }

    // Response model matching ACEStepOutput in Python
    public class ACEStepOutput
    {
        public string Status { get; set; }
        public string OutputPath { get; set; }
        public string Message { get; set; }
    }

    // Checks if the server is healthy
    public async Task<bool> IsHealthyAsync()
    {
        try
        {
            var response = await _httpClient.GetAsync($"{_baseUrl}/health");
            if (!response.IsSuccessStatusCode)
                return false;

            var json = await response.Content.ReadAsStringAsync();
            using var doc = JsonDocument.Parse(json);
            if (doc.RootElement.TryGetProperty("status", out var statusProp))
            {
                return statusProp.GetString()?.ToLower() == "healthy";
            }
            return false;
        }
        catch
        {
            return false;
        }
    }

    // Call generate endpoint to produce audio and get the output filename
    public async Task<ACEStepOutput> GenerateAudioAsync(ACEStepInput input)
    {
        var url = $"{_baseUrl}/generate";

        var jsonOptions = new JsonSerializerOptions
        {
            PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
            WriteIndented = false
        };

        var jsonContent = JsonSerializer.Serialize(input, jsonOptions);
        using var content = new StringContent(jsonContent, Encoding.UTF8, "application/json");

        var response = await _httpClient.PostAsync(url, content);

        if (!response.IsSuccessStatusCode)
        {
            var errorMsg = await response.Content.ReadAsStringAsync();
            throw new Exception($"Server returned error {(int)response.StatusCode}: {errorMsg}");
        }

        var responseBody = await response.Content.ReadAsStringAsync();

        try
        {
            var output = JsonSerializer.Deserialize<ACEStepOutput>(responseBody, jsonOptions);
            return output;
        }
        catch (JsonException ex)
        {
            throw new Exception("Failed to parse response JSON: " + ex.Message);
        }
    }
}

'my inference into my c# class'
    public async void GenerateSong(string lyrics, string genrePrompt, int steps, float length)
    {
        var musicGen = new AceStepMusicGen("http://localhost:8000");

        bool healthy = await musicGen.IsHealthyAsync();
        Console.WriteLine($"Server healthy? {healthy}");

        if (!healthy)
        {
            Console.WriteLine("Server is not healthy, aborting.");
            return;
        }

        var input = new AceStepMusicGen.ACEStepInput
        {
            AudioDuration = length,
            Prompt = genrePrompt,
            Lyrics = lyrics,
            InferStep = steps,
            GuidanceScale = 15f,
            SchedulerType = "euler",
            CfgType = "apg",
            OmegaScale = 0.7f,
            ActualSeeds = new List<int> {},
            GuidanceInterval = 1.0f,
            GuidanceIntervalDecay = 0f,
            MinGuidanceScale = 3f,
            UseErgTag = true,
            UseErgLyric = false,
            UseErgDiffusion = true,
            OssSteps = new List<int> {},
            GuidanceScaleText = 0f,
            GuidanceScaleLyric = 0f
        };

        try
        {
            var output = await musicGen.GenerateAudioAsync(input);
            Console.WriteLine($"Generation status: {output.Status}");
            Console.WriteLine($"Output file: {output.OutputPath}");
            Console.WriteLine($"Message: {output.Message}");
        }
        catch (Exception ex)
        {
            Console.WriteLine("Error generating audio: " + ex.Message);
        }
    }

    private void button20_Click(object sender, EventArgs e)
    {
        GenerateSong(textBox4.Text, textBox5.Text, 25, 10);
    }
}

'my uvicorn server'
import os

# Must be set before other imports that load OpenMP runtime
os.environ["KMP_DUPLICATE_LIB_OK"] = "TRUE"

from fastapi import FastAPI, HTTPException
from fastapi.staticfiles import StaticFiles
from pydantic import BaseModel
from typing import List, Optional
import uuid
from acestep.pipeline_ace_step import ACEStepPipeline
import asyncio
from contextlib import asynccontextmanager

# Globals for pipeline & lock
preloaded_pipeline: Optional[ACEStepPipeline] = None
pipeline_lock: Optional[asyncio.Lock] = None

PRELOAD_CONFIG = {
    "checkpoint_path": "",
    "bf16": True,
    "torch_compile": False,
    "device_id": 0,
}

class ACEStepInput(BaseModel):
    audio_duration: float
    prompt: str
    lyrics: str
    infer_step: int
    guidance_scale: float
    scheduler_type: str
    cfg_type: str
    omega_scale: float
    actual_seeds: List[int]
    guidance_interval: float
    guidance_interval_decay: float
    min_guidance_scale: float
    use_erg_tag: bool
    use_erg_lyric: bool
    use_erg_diffusion: bool
    oss_steps: List[int]
    guidance_scale_text: float = 0.0
    guidance_scale_lyric: float = 0.0


class ACEStepOutput(BaseModel):
    status: str
    output_path: Optional[str]
    message: str


def initialize_pipeline(
    checkpoint_path: str,
    bf16: bool,
    torch_compile: bool,
    device_id: int,
) -> ACEStepPipeline:

    current_cuda_visible_devices = os.environ.get("CUDA_VISIBLE_DEVICES")
    if current_cuda_visible_devices != str(device_id):
        os.environ["CUDA_VISIBLE_DEVICES"] = str(device_id)

    dtype = "bfloat16" if bf16 else "float32"
    pipeline = ACEStepPipeline(
        checkpoint_dir=checkpoint_path,
        dtype=dtype,
        torch_compile=torch_compile,
    )
    return pipeline


async def run_generation_in_thread(pipeline, params, output_path):
    loop = asyncio.get_running_loop()
    await loop.run_in_executor(None, lambda: pipeline(*params, save_path=output_path))


@asynccontextmanager
async def lifespan(app: FastAPI):
    global preloaded_pipeline, pipeline_lock
    # Startup logic
    cfg = PRELOAD_CONFIG
    preloaded_pipeline = initialize_pipeline(
        cfg["checkpoint_path"],
        cfg["bf16"],
        cfg["torch_compile"],
        cfg["device_id"],
    )
    pipeline_lock = asyncio.Lock()
    print("Preloaded model pipeline at startup.")
    yield
    # Shutdown logic
    preloaded_pipeline = None
    pipeline_lock = None
    print("Pipeline cleaned up on shutdown.")


app = FastAPI(title="ACEStep Pipeline API", lifespan=lifespan)

# Serve audio files from current working directory
app.mount("/files", StaticFiles(directory=os.getcwd()), name="files")


@app.post("/generate", response_model=ACEStepOutput)
async def generate_audio(input_data: ACEStepInput):
    if preloaded_pipeline is None or pipeline_lock is None:
        raise HTTPException(status_code=503, detail="Model pipeline is not ready")

    try:
        params = (
            input_data.audio_duration,
            input_data.prompt,
            input_data.lyrics,
            input_data.infer_step,
            input_data.guidance_scale,
            input_data.scheduler_type,
            input_data.cfg_type,
            input_data.omega_scale,
            ", ".join(map(str, input_data.actual_seeds)),
            input_data.guidance_interval,
            input_data.guidance_interval_decay,
            input_data.min_guidance_scale,
            input_data.use_erg_tag,
            input_data.use_erg_lyric,
            input_data.use_erg_diffusion,
            ", ".join(map(str, input_data.oss_steps)),
            input_data.guidance_scale_text,
            input_data.guidance_scale_lyric,
        )

        filename = f"output_{uuid.uuid4().hex}.wav"
        output_path = os.path.join(os.getcwd(), filename)

        async with pipeline_lock:
            await run_generation_in_thread(preloaded_pipeline, params, output_path)

        return ACEStepOutput(
            status="success",
            output_path=filename,
            message="Audio generated successfully",
        )
    except Exception as e:
        raise HTTPException(status_code=500, detail=f"Error generating audio: {str(e)}")


@app.get("/health")
async def health_check():
    return {"status": "healthy"}


if __name__ == "__main__":
    import uvicorn

    uvicorn.run(app, host="0.0.0.0", port=8000)