Spaces:
Sleeping
Sleeping
| import subprocess | |
| import sys | |
| import streamlit as st | |
| # Funktion zur Installation von Paketen | |
| def install(package_name): | |
| try: | |
| subprocess.check_call([sys.executable, "-m", "pip", "install", package_name]) | |
| print(f"{package_name} erfolgreich installiert.") | |
| except subprocess.CalledProcessError as e: | |
| print(f"Fehler bei der Installation von {package_name}: {e}") | |
| st.title(":orange[Por]:blue[tal] _Wheatley_ :red[TTS] Training") | |
| def install_dependencies(): | |
| try: | |
| with st.spinner("Installing espeak-ng and TTS..."): | |
| install("py-espeak-ng") | |
| install("TTS") | |
| st.success("Dependencies installed successfully!") | |
| except Exception as e: | |
| st.error(f"Error occurred while installing dependencies: {e}") | |
| def run_training(): | |
| config = "Coqui_config.json" | |
| # Der Befehl, den du ausführen möchtest | |
| command = [ | |
| sys.executable, # Der Python-Interpreter | |
| "-m", "TTS.bin.train_tts", # Modell für das Training | |
| "--config_path", config # Der Pfad zur Konfigurationsdatei | |
| ] | |
| # Spinner für den Trainingsprozess | |
| with st.spinner("Training is in progress..."): | |
| try: | |
| st.text("Starting the Training...") | |
| subprocess.run(command, check=True) | |
| st.text("Training completed.") | |
| except subprocess.CalledProcessError as e: | |
| st.error(f"Error while executing the command: {e}") | |
| except FileNotFoundError as e: | |
| st.error(f"FileNotFoundError: File {config} does not exist: {e}") | |
| if __name__ == "__main__": | |
| install_dependencies() | |
| # Benutzerinput mit einem Button zum Starten des Trainings | |
| if st.button("Train Wheatley Voice"): | |
| run_training() | |