Teapack1's picture
Merge branch 'main' of https://huggingface.co/spaces/Teapack1/ASR-w-ZeroShotClassification-Assistant
f6005b0
raw
history blame
691 Bytes
import json
import os
import requests
import socket
import subprocess
subprocess.run("uvicorn server:app --host 0.0.0.0 --port 7860", shell=True)
#os.system("uvicorn server:app --reload")
"""
def start_server():
os.system("uvicorn server:app --port 8080 --workers 2")
os.system("uvicorn server:app --port 8080 --workers 2")
def is_port_in_use(port):
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
return s.connect_ex(('0.0.0.0', port)) == 0
def main():
if is_port_in_use(8080):
print("Port 8080 is already in use. Please kill the process and try again.")
else:
start_server()
main()
"""
main()
"""