Update handler.py
Browse files- handler.py +8 -7
handler.py
CHANGED
|
@@ -49,12 +49,12 @@ for command in commands:
|
|
| 49 |
logger.info(f"SUCCESS CMD: {command}")
|
| 50 |
except subprocess.CalledProcessError as e:
|
| 51 |
logger.info(f"Failed CMD: {e}")
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
|
| 59 |
class EndpointHandler:
|
| 60 |
def __init__(self, path=""):
|
|
@@ -70,7 +70,8 @@ class EndpointHandler:
|
|
| 70 |
self.pipe.vae, mode="max-autotune-no-cudagraphs",
|
| 71 |
)
|
| 72 |
# ngrok
|
| 73 |
-
self.public_url =
|
|
|
|
| 74 |
# subprocess.Popen(['ngrok', 'http', '5000'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
| 75 |
|
| 76 |
logger.info("Ngrok is running in the background.")
|
|
|
|
| 49 |
logger.info(f"SUCCESS CMD: {command}")
|
| 50 |
except subprocess.CalledProcessError as e:
|
| 51 |
logger.info(f"Failed CMD: {e}")
|
| 52 |
+
def run_ngrok():
|
| 53 |
+
subprocess.run(["ngrok", "http", "6000"])
|
| 54 |
+
ngrok_thread = threading.Thread(target=run_ngrok)
|
| 55 |
+
ngrok_thread.daemon = True
|
| 56 |
+
ngrok_thread.start()
|
| 57 |
+
logger.info("ngrok is running in the background")
|
| 58 |
|
| 59 |
class EndpointHandler:
|
| 60 |
def __init__(self, path=""):
|
|
|
|
| 70 |
self.pipe.vae, mode="max-autotune-no-cudagraphs",
|
| 71 |
)
|
| 72 |
# ngrok
|
| 73 |
+
self.public_url = os.getcwd()
|
| 74 |
+
# self.public_url = ngrok.connect(6000).public_url
|
| 75 |
# subprocess.Popen(['ngrok', 'http', '5000'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
| 76 |
|
| 77 |
logger.info("Ngrok is running in the background.")
|