Skip to content

Commit

Permalink
Update pandrator.py
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszliniewicz authored Nov 2, 2024
1 parent 6b3fa7b commit 3516f9d
Showing 1 changed file with 2 additions and 26 deletions.
28 changes: 2 additions & 26 deletions pandrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
import base64
from PIL import Image
import yt_dlp
from dulwich import porcelain

# Conditional imports for torch and RVC
try:
Expand Down Expand Up @@ -2289,7 +2288,7 @@ def only_transcribe(self):
# Transcription using the WAV file
output_srt = os.path.join(session_dir, f"{video_filename}.srt")
whisperx_command = [
"../conda/Scripts/conda.exe", "run", "-n", "whisperx_installer",
"../conda/Scripts/conda.exe", "run", "-p", "../conda/envs/whisperx_installer", "--no-capture-output",
"python", "-m", "whisperx",
wav_file,
"--model", self.whisperx_model.get(),
Expand Down Expand Up @@ -2543,30 +2542,7 @@ def select_file(self):
).get()

if response == "Ok":
# Check if PyCropPDF exists
if not os.path.exists("PyCropPDF"):
try:
# Clone the repository
from dulwich import porcelain
porcelain.clone("https://github.com/lukaszliniewicz/PyCropPDF.git", "PyCropPDF")

# Install requirements
requirements_file = os.path.join("PyCropPDF", "requirements.txt")
if os.path.exists(requirements_file):
subprocess.run([
"pip", "install", "-r", requirements_file
], check=True)
else:
subprocess.run([
"pip", "install", "PyQt5", "PyMuPDF"
], check=True)

except Exception as e:
CTkMessagebox(title="Error",
message=f"Failed to set up PyCropPDF: {str(e)}",
icon="cancel")
return


source_dir = os.path.dirname(self.pre_selected_source_file)
source_filename = os.path.splitext(os.path.basename(self.pre_selected_source_file))[0]
cropped_filename = f"{source_filename}_cropped.pdf"
Expand Down

0 comments on commit 3516f9d

Please sign in to comment.