Spaces:
Paused
Paused
File size: 1,175 Bytes
117ca40 28162e3 117ca40 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
import multiprocessing
from app import app as main_app
import sys
import os
import subprocess
subprocess.run(["pip", "install", "coqui-tts==0.25.1", "--no-deps"])
# Add the titulky directory to Python path
#sys.path.append(os.path.join(os.path.dirname(__file__), 'titulky'))
#from titulky.app import app as subtitle_app
def run_main_app():
main_app.run(host="0.0.0.0", port=7860, debug=False)
#def run_subtitle_app():
# subtitle_app.run(host="0.0.0.0", port=7860, debug=False)
if __name__ == "__main__":
# Create processes
main_process = multiprocessing.Process(target=run_main_app)
# subtitle_process = multiprocessing.Process(target=run_subtitle_app)
try:
# Start both processes
main_process.start()
# subtitle_process.start()
# Wait for both processes to complete
main_process.join()
# subtitle_process.join()
except KeyboardInterrupt:
# Handle Ctrl+C gracefully
print("\nShutting down servers...")
main_process.terminate()
# subtitle_process.terminate()
main_process.join()
# subtitle_process.join()
print("Servers shut down successfully") |