v25.12.28

This commit is contained in:
ROBERT MCDOWELL
2025-12-28 14:47:26 -08:00
committed by GitHub
3 changed files with 168 additions and 165 deletions

View File

@@ -151,6 +151,7 @@ class XTTSv2(TTSUtils, TTSRegistry, name='xtts'):
error = f"Unsupported XTTSv2 wav type: {type(audio_sentence)}"
print(error)
return False
audio_tensor = audio_tensor.detach().cpu()
if sentence[-1].isalnum() or sentence[-1] == '':
audio_tensor = trim_audio(audio_tensor.squeeze(), self.params['samplerate'], 0.001, trim_audio_buffer).unsqueeze(0)
if audio_tensor is not None and audio_tensor.numel() > 0:

View File

@@ -1167,16 +1167,18 @@ def build_interface(args:dict)->gr.Blocks:
if not any(v[1] == session['voice'] for v in voice_options):
voice_path = Path(session['voice'])
parts = list(voice_path.parts)
idx = parts.index("voices")
parts[idx + 1] = session['language']
new_voice_path = str(Path(*parts))
if os.path.exists(new_voice_path):
session['voice'] = new_voice_path
else:
parts[idx + 1] = 'eng'
session['voice'] = str(Path(*parts))
if "voices" in parts:
idx = parts.index("voices")
if idx + 1 < len(parts):
parts[idx + 1] = session['language']
new_voice_path = str(Path(*parts))
if os.path.exists(new_voice_path):
session['voice'] = new_voice_path
else:
parts[idx + 1] = 'eng'
session['voice'] = str(Path(*parts))
else:
if session['voice'] is None and voice_options and voice_options[0][1] is not None:
if voice_options and voice_options[0][1] is not None:
session['voice'] = models[session['fine_tuned']]['voice']
return gr.update(choices=voice_options, value=session['voice'])
except Exception as e:

View File

@@ -1,157 +1,157 @@
@echo off
setlocal enabledelayedexpansion
:: ---------------------------------------
:: CONFIG
:: ---------------------------------------
set "APP_NAME=ebook2audiobook"
set "SCRIPT_DIR=%~dp0"
set "STARTMENU_DIR=%APPDATA%\Microsoft\Windows\Start Menu\Programs\%APP_NAME%"
set "DESKTOP_LNK=%USERPROFILE%\Desktop\%APP_NAME%.lnk"
set "INSTALLED_LOG=%SCRIPT_DIR%.installed"
set "MINIFORGE_PATH=%USERPROFILE%\Miniforge3"
set "SELF=%~f0"
set "TEMP_UNINSTALL=%TEMP%\%APP_NAME%_uninstall.cmd"
:: ---------------------------------------
echo.
echo ========================================================
echo %APP_NAME% — Uninstaller (Secure & Verified Execution)
echo ========================================================
echo Running from: %SELF%
echo.
:: ---------------------------------------
:: SELF-RELAUNCH FROM TEMP (SAFER DESIGN)
:: ---------------------------------------
if /i not "%SELF%"=="%TEMP_UNINSTALL%" (
echo Preparing safe removal environment...
echo Copying uninstaller to TEMP: %TEMP_UNINSTALL%
copy "%SELF%" "%TEMP_UNINSTALL%" >nul
echo Relaunching installer from safe location...
start "" "%TEMP_UNINSTALL%" "%SCRIPT_DIR%"
echo Cleaning handoff...
exit /b
)
:: At this point, the script runs safely from temp
if "%~1"=="" (
echo [ERROR] Install directory missing — cannot continue.
pause
exit /b 1
)
set "REAL_INSTALL_DIR=%~1"
echo.
echo ========================================
echo Uninstalling %APP_NAME%
echo ========================================
echo.
choice /M "Proceed with uninstall?" /C YN
if errorlevel 2 exit /b
cd /d "%REAL_INSTALL_DIR%\.."
:: ---------------------------------------
:: KILL PROCESSES (POLITE FIRST)
:: ---------------------------------------
echo.
echo Checking for running program instances...
tasklist | find /i "%APP_NAME%.exe" >nul && (
echo %APP_NAME%.exe is currently running.
choice /M "Terminate it to continue?" /C YN
if errorlevel 1 taskkill /IM "%APP_NAME%.exe" /F >nul 2>&1
)
tasklist | find /i "python.exe" >nul && (
echo Python is active and may be linked to the app.
choice /M "Close python.exe automatically?" /C YN
if errorlevel 1 taskkill /IM "python.exe" /F >nul 2>&1
)
:: ---------------------------------------
:: PROCESS .installed PACKAGES
:: ---------------------------------------
set "REMOVE_MINIFORGE="
set "SCOOP_PRESENT="
if exist "%INSTALLED_LOG%" (
echo.
echo Reading .installed packages list...
for /f "usebackq delims=" %%A in ("%INSTALLED_LOG%") do (
set "ITEM=%%A"
if "!ITEM!"=="" (continue)
if /i "!ITEM!"=="Miniforge3" (
set "REMOVE_MINIFORGE=1"
echo Marked Miniforge3 for removal...
continue
)
if /i "!ITEM!"=="scoop" (
set "SCOOP_PRESENT=1"
echo Scoop presence detected — will remove at end...
continue
)
echo Uninstalling package using Scoop: !ITEM!
scoop uninstall "!ITEM!" >nul 2>&1
)
)
:: ---------------------------------------
:: REMOVE MINIFORGE3
:: ---------------------------------------
if defined REMOVE_MINIFORGE (
if exist "%MINIFORGE_PATH%" (
echo.
echo Removing Miniforge3: %MINIFORGE_PATH%
rd /s /q "%MINIFORGE_PATH%" >nul 2>&1
)
)
:: ---------------------------------------
:: DEFERRED SCOOP UNINSTALL
:: ---------------------------------------
if defined SCOOP_PRESENT (
echo.
echo Removing Scoop and cleanup...
start "" cmd /c "ping 127.0.0.1 -n 3 >nul & scoop uninstall scoop >nul 2>&1 & rd /s /q "%USERPROFILE%\scoop" >nul 2>&1"
)
:: ---------------------------------------
:: REMOVE SHORTCUTS AND REGISTRY
:: ---------------------------------------
echo.
echo Removing Menu entries & Desktop shortcuts...
if exist "%STARTMENU_DIR%" rd /s /q "%STARTMENU_DIR%" >nul 2>&1
if exist "%DESKTOP_LNK%" del /q "%DESKTOP_LNK%" >nul 2>&1
reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall\ebook2audiobook" /f >nul 2>&1
:: ---------------------------------------
:: DELETE THE ACTUAL APP FOLDER
:: ---------------------------------------
echo.
echo Removing application directory:
echo %REAL_INSTALL_DIR%
rd /s /q "%REAL_INSTALL_DIR%" >nul 2>&1
:: ---------------------------------------
:: DELETE SELF COPY & EXIT
:: ---------------------------------------
echo.
echo ============================
echo Uninstallation complete.
echo ============================
echo Cleaning temporary uninstaller...
del "%TEMP_UNINSTALL%" >nul 2>&1
timeout /t 2 >nul
@echo off
setlocal enabledelayedexpansion
:: ---------------------------------------
:: CONFIG
:: ---------------------------------------
set "APP_NAME=ebook2audiobook"
set "SCRIPT_DIR=%~dp0"
set "STARTMENU_DIR=%APPDATA%\Microsoft\Windows\Start Menu\Programs\%APP_NAME%"
set "DESKTOP_LNK=%USERPROFILE%\Desktop\%APP_NAME%.lnk"
set "INSTALLED_LOG=%SCRIPT_DIR%.installed"
set "MINIFORGE_PATH=%USERPROFILE%\Miniforge3"
set "SELF=%~f0"
set "TEMP_UNINSTALL=%TEMP%\%APP_NAME%_uninstall.cmd"
:: ---------------------------------------
echo.
echo ========================================================
echo %APP_NAME% — Uninstaller (Secure & Verified Execution)
echo ========================================================
echo Running from: %SELF%
echo.
:: ---------------------------------------
:: SELF-RELAUNCH FROM TEMP (SAFER DESIGN)
:: ---------------------------------------
if /i not "%SELF%"=="%TEMP_UNINSTALL%" (
echo Preparing safe removal environment...
echo Copying uninstaller to TEMP: %TEMP_UNINSTALL%
copy "%SELF%" "%TEMP_UNINSTALL%" >nul
echo Relaunching installer from safe location...
start "" cmd /c "%TEMP_UNINSTALL%" "%SCRIPT_DIR%"
echo Cleaning handoff...
exit /b
)
:: At this point, the script runs safely from temp
if "%~1"=="" (
echo [ERROR] Install directory missing — cannot continue.
pause
exit /b 1
)
set "REAL_INSTALL_DIR=%~1"
echo.
echo ========================================
echo Uninstalling %APP_NAME%
echo ========================================
echo.
choice /M "Proceed with uninstall?" /C YN
if errorlevel 2 exit /b
cd /d "%REAL_INSTALL_DIR%\.."
:: ---------------------------------------
:: KILL PROCESSES (POLITE FIRST)
:: ---------------------------------------
echo.
echo Checking for running program instances...
tasklist | find /i "%APP_NAME%.exe" >nul && (
echo %APP_NAME%.exe is currently running.
choice /M "Terminate it to continue?" /C YN
if errorlevel 1 taskkill /IM "%APP_NAME%.exe" /F >nul 2>&1
)
tasklist | find /i "python.exe" >nul && (
echo Python is active and may be linked to the app.
choice /M "Close python.exe automatically?" /C YN
if errorlevel 1 taskkill /IM "python.exe" /F >nul 2>&1
)
:: ---------------------------------------
:: PROCESS .installed PACKAGES
:: ---------------------------------------
set "REMOVE_MINIFORGE="
set "SCOOP_PRESENT="
if exist "%INSTALLED_LOG%" (
echo.
echo Reading .installed packages list...
for /f "usebackq delims=" %%A in ("%INSTALLED_LOG%") do (
set "ITEM=%%A"
if "!ITEM!"=="" (continue)
if /i "!ITEM!"=="Miniforge3" (
set "REMOVE_MINIFORGE=1"
echo Marked Miniforge3 for removal...
continue
)
if /i "!ITEM!"=="scoop" (
set "SCOOP_PRESENT=1"
echo Scoop presence detected — will remove at end...
continue
)
echo Uninstalling package using Scoop: !ITEM!
scoop uninstall "!ITEM!" >nul 2>&1
)
)
:: ---------------------------------------
:: REMOVE MINIFORGE3
:: ---------------------------------------
if defined REMOVE_MINIFORGE (
if exist "%MINIFORGE_PATH%" (
echo.
echo Removing Miniforge3: %MINIFORGE_PATH%
rd /s /q "%MINIFORGE_PATH%" >nul 2>&1
)
)
:: ---------------------------------------
:: DEFERRED SCOOP UNINSTALL
:: ---------------------------------------
if defined SCOOP_PRESENT (
echo.
echo Removing Scoop and cleanup...
start "" cmd /c "ping 127.0.0.1 -n 3 >nul & scoop uninstall scoop >nul 2>&1 & rd /s /q "%USERPROFILE%\scoop" >nul 2>&1"
)
:: ---------------------------------------
:: REMOVE SHORTCUTS AND REGISTRY
:: ---------------------------------------
echo.
echo Removing Menu entries & Desktop shortcuts...
if exist "%STARTMENU_DIR%" rd /s /q "%STARTMENU_DIR%" >nul 2>&1
if exist "%DESKTOP_LNK%" del /q "%DESKTOP_LNK%" >nul 2>&1
reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall\ebook2audiobook" /f >nul 2>&1
:: ---------------------------------------
:: DELETE THE ACTUAL APP FOLDER
:: ---------------------------------------
echo.
echo Removing application directory:
echo %REAL_INSTALL_DIR%
rd /s /q "%REAL_INSTALL_DIR%" >nul 2>&1
:: ---------------------------------------
:: DELETE SELF COPY & EXIT
:: ---------------------------------------
echo.
echo ============================
echo Uninstallation complete.
echo ============================
echo Cleaning temporary uninstaller...
del "%TEMP_UNINSTALL%" >nul 2>&1
timeout /t 2 >nul
exit /b