Need help for calling "Piper"

Hello All!
Im glad and excited to be part of this forum.

Im trying to have Piper - the TTS engine on my windows computer and I decided to take help from GPT (I know it might be the dumbest thing to do, but I know nothing about this stuff and the GPT was easiest way to do it
So, few things GPT got right: It helped me guiding how should I be installing the piper, which files should I download and also helped me to select the voice of my liking and download it.
Next thing was to test it! After few failed attempts on GPT I decided to dig it up on the internet and got it working manually. I was successfully able to create a text file with some content in it and then from PowerShell run command to create an audio file and then also played it from the PowerShell

Next thing was to connect it to the LLM I have installed on my computer already and this is the script GPT came up with, which I fell is wrong:

import subprocess
import os

# Paths
piper = "C:\\Users\\admin\\piper\\piper\\piper.exe"
model = "C:\\Users\\admin\\piper\\piper\\models\\en_US-libritts-high\\libritts-high.onnx"
config = "C:\\Users\\admin\\piper\\piper\\models\\en_US-libritts-high\\config.json"
output = "C:\\Users\\admin\\piper\\piper\\response.wav"

# Delete old file if it exists
if os.path.exists(output):
    os.remove(output)

# Run piper with --text directly
result = subprocess.run([
    piper,
    "--m", model,
    "--c", config,
    "--text", "This is the final test using the text flag.",
    "--f", output
])

# Check result
if os.path.exists(output):
    print(" Piper generated the audio!")
    subprocess.run(["start", output], shell=True)
else:
    print(" Piper still did not create the output.")

So, what Im missing here? I have varied experience in embedded programming but this is something Im doing as a hobby project. And I would love to have your valuable inputs

Thanks and grateful in advance. Looking forward

So you’re using a python program to run two shell commands, and you don’t understand the python script, nor do you understand shell commands. That’s pretty dangerous.

There’s a couple of points here. One thing that looks wrong is "--m". In powershell (and bash) you typically use one dash for a single letter, and 2 for a keyword, so it should be -m -c --text -f.

If all you’re doing with a python program is to call a subprocess, just run the subprocess directly, in the terminal (powershell or bash). (Or write a bash/shell script.)
If you give chatgpt the terminal output it is pretty good at fixing terminal command, but if you give chatgpt control over your terminal it can completely brick your computer. You need to have some baseline familiarity with the terminal to make it safe. And I don’t think using subprocess.run provides any safety in that regards, it just makes the error and help messages less easy to access.

the documentation on GitHub - rhasspy/piper: A fast, local neural text to speech system seems pretty clear to me. Note the example scripts are written in bash, not powershell. If you want to run this without unnecessary trouble, install/use bash, and use a bash script. (No Python.) ChatGPT is a useful tool, but try to rely a little less on it.