=-=-=-=-=-=-=-=-=-=-=-=-=-

Resident English Clipboard Reader Based on Piper tts

Four Piper TTS neural voice models (.onnx files). These are the AI models that convert text to speech locally on your machine. No data is sent to the internet.

https://github.com/Brets0150/ReadToMe-TTS/releases

configure it to use Use win+insert

It is fast

This is a text-to-speech synthesizer that uses Piper TTS engine to read text aloud.

I replaced one of voices with farsi  that I separately got by

git clone https://huggingface.co/MahtaFetrat/Mana-Persian-Piper

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Install Python

python -m pip install flask

will be installed somewhere like

C:\Users\amir\AppData\Roaming\Python\Python314\site-packages\

https://huggingface.co/MahtaFetrat/Mana-Persian-Piper

Install Piper

python -m pip install piper-tts

will be installed somewhere like

C:\Users\amir\AppData\Roaming\Python\Python314\site-packages\

Download the Model

git clone https://huggingface.co/MahtaFetrat/Mana-Persian-Piper

 

make the file app.py which will be serving a page in folder c:\amir\amirpy

copy the  Mana-Persian-Piper to

C:\amir\amirpy\content\Mana-Persian-Piper\fa_IR-mana-medium.onnx

import wave
import time

#This loads the Flask library.
from flask import Flask, request, send_file, render_template_string
from piper import PiperVoice

#This creates the Flask server object.
app = Flask(__name__)

voice = PiperVoice.load(
r”C:\amir\amirpy\content\Mana-Persian-Piper\fa_IR-mana-medium.onnx”
)

HTML = “””
<!DOCTYPE html>
<html>
<head>
<meta charset=”UTF-8″>
<title>Persian Piper TTS</title>
</head>

<body style=”font-family: Arial; margin: 40px;”>

<h2>Persian Text to Speech</h2>

<textarea id=”text” rows=”12″ cols=”90″
style=”font-size:18px; direction:rtl;”></textarea>

<br><br>

<button onclick=”speak()” style=”font-size:18px;”>Speak</button>

<p id=”status”></p>

<audio id=”player” controls style=”width:600px;”></audio>

<script>
async function speak() {
const text = document.getElementById(“text”).value;
const status = document.getElementById(“status”);
const player = document.getElementById(“player”);

status.innerText = “Generating speech…”;

const response = await fetch(“/speak”, {
method: “POST”,
headers: {
“Content-Type”: “application/json”
},
body: JSON.stringify({ text: text })
});

if (!response.ok) {
status.innerText = “Error generating speech.”;
return;
}

const blob = await response.blob();
const audioUrl = URL.createObjectURL(blob);

player.src = audioUrl;
player.play();

status.innerText = “Playing.”;
}
</script>

</body>
</html>
“””

@app.route(“/”)
def index():
return render_template_string(HTML)

#If the browser sends a POST request to /speak
#run the function speak()
@app.route(“/speak”, methods=[“POST”])
def speak():
data = request.get_json()
text = data.get(“text”, “”).strip()

if not text:
return “No text entered.”, 400

output_file = f”test_{int(time.time())}.wav”

with wave.open(output_file, “wb”) as wav_file:
voice.synthesize_wav(text, wav_file)

return send_file(output_file, mimetype=”audio/wav”)

#The port is determined by this line: app.run(debug=True)
#When no port is specified, Flask defaults to: Host: 127.0.0.1    Port: 5000
#To use a different port, specify it explicitly:
#app.run(debug=True, port=8080)
#Then open: http://127.0.0.1:8080
#Or:
#app.run(debug=True, host=”0.0.0.0″, port=8080)
#which allows access from other devices on your network.

#Start Flask This is the line that actually launches the web server:
if __name__ == “__main__”:
app.run(debug=True)

 

Run it:

 
python app.py
 

Then open this in your browser:

 
http://127.0.0.1:5000

=-=-=-=-=-=-=-=-=-=-

use Auto PY to EXE. It provides a clean web-based interface built on top of PyInstaller. [1]
  1. Install the package:
    bash
    pip install auto-py-to-exe
    
    Use code with caution.

     

  2. Launch the interface:
    bash
    auto-py-to-exe
    
    Use code with caution.

     

  3. Select your script, choose “One File”, configure your icons or files, and click Convert .py to .exe. [1, 2, 3, 4, 5]

Never build your executable from your global Python environment.If you use your main Python environment, auto-py-to-exe (via PyInstaller) will often accidentally grab unrelated packages you installed for other projects, ballooning your file size.To get the smallest file possible, always do this first:Create a fresh, empty virtual environment for your project.Activate it.Install only auto-py-to-exe and the exact libraries your specific script needs.Run auto-py-to-exe from inside that activated environment

Step 1: Create the Empty Environment
Open your terminal or command prompt, navigate to your project folder, and run the command for your operating system: [1]
  • Windows:
    cmd
    python -m venv myenv --without-pip
    
    Use code with caution.

     

  • macOS / Linux:
    bash
    python3 -m venv myenv --without-pip
    
    Use code with caution.

     

(Replace myenv with whatever name you want to give your environment folder). [1]

Step 2: Activate the Environment [1]
You must activate the environment before using it. [1, 2]
  • Windows (Command Prompt):
    cmd
    myenv\Scripts\activate.bat
    
    Use code with caution.

     

  • Windows (PowerShell):
    powershell
    .\myenv\Scripts\Activate.ps1
    
    Use code with caution.

     

  • macOS / Linux:
    bash
    source myenv/bin/activate
    
    Use code with caution.

     

    [1, 2, 3, 4]

Once activated, your terminal prompt will show (myenv) at the beginning of the line. [1]

Step 3: How to Verify It Is Truly Empty
To confirm that absolutely nothing is installed in this environment, run:
bash
pip list
Use code with caution.

 

Because you used the --without-pip flag, your system will return an error stating that 'pip' is not recognized or found. This proves the environment is entirely bare and contains only the core Python binary files. [1, 2]

Warning: How to Install Packages Later
Because this environment has no package manager (pip), you cannot install libraries normally. If you actually meant a clean, standard environment (which only includes pip and setuptools but no heavy third-party libraries), omit the flag: [1, 2, 3, 4, 5]
bash
python -m venv myenv
Use code with caution.

 

If you are setting this up for your standalone executable, let me know:
  • Do you need to manually inject pip into this empty environment?
  • What is the exact script or library you need to run inside it?
I can guide you through the manual installation steps.

 

 
 
 

=-=-=-=-=-=-=-=-=-

How to Deploy Flask on cPanel
Deploying a Flask application on a cPanel server involves a straightforward process managed via the Phusion Passenger application server. [1]
  1. Create the Application: Log in to cPanel, go to the Software section, and click Setup Python App. Click Create Application, select your desired Python version, and set the application directory. [1, 2]
  2. Install Dependencies: cPanel allows you to declare a requirements.txt file and run pip installation directly from the Python Selector screen. [1, 2, 3]
  3. Configure the WSGI File: cPanel automatically generates a passenger_wsgi.py file. You will need to edit this file in the File Manager to link it to your primary Flask file (e.g., from app import app as application). [1, 2, 3]
  4. Restart: Once the configuration is set, restart the application from the Setup Python App page to apply the changes. [1]
Important Considerations
  • Hosting Support: Your hosting provider must have the cPanel Python Selector feature enabled.
  • Environment: cPanel handles Python applications by automatically creating a virtual environment for each app.
  • Routing Entry Point: In Flask, your main app instance must be named application in the WSGI file to interface correctly with Phusion Passenger

 

=-=-=-=-=-=-=-

 

Loading