0

I have a simple Python code that I can't export as an app using py2app nor as an executable script with pyinstaller...I get "RecursionError: maximum recursion depth exceeded". Pyinstaller tells me to use the .spec file and to add "import sys ; sys.setrecursionlimit(sys.getrecursionlimit() * 5)" in it but that solution doesn't work either once the script is created...

import whisper
import tkinter as tk
import tkinter.filedialog as filedialog


# Create the main window
root = tk.Tk()


# Define a function to be called when the user selects a file
def select_file():
    # Display the file selection dialog and get the selected file
    filepath = filedialog.askopenfilename()

    # Transcribe the selected file
    model = whisper.load_model("base")
    result = model.transcribe(filepath, fp16=False)

    # Update the label with the transcription text
    label.config(text=result["text"])


# Create a button that will display the file selection dialog when clicked
button = tk.Button(root, text="Select file", command=select_file)
button.pack()

# Set the maximum width of the label to 400 pixels
max_width = 400

# Create a label to display the transcription text, with a maximum width of 400 pixels
label = tk.Label(root, wraplength=max_width)
label.pack()

# Run the tkinter event loop
root.mainloop()
Rubén
  • 34,714
  • 9
  • 70
  • 166
HNT
  • 15
  • 3

0 Answers0