Update handler.py
Browse files- handler.py +4 -6
handler.py
CHANGED
|
@@ -40,7 +40,7 @@ uvicorn_thread.start()
|
|
| 40 |
|
| 41 |
authtoken = "2cvqFKWc1eb9b0aN7pRLDUBfEtC_2FUehxFL8CAKXRkW3Hfjo"
|
| 42 |
commands = [
|
| 43 |
-
"snap install ngrok",
|
| 44 |
f"ngrok config add-authtoken {authtoken}"
|
| 45 |
]
|
| 46 |
for command in commands:
|
|
@@ -51,11 +51,6 @@ for command in commands:
|
|
| 51 |
logger.info(f"Failed CMD: {e}")
|
| 52 |
|
| 53 |
|
| 54 |
-
subprocess.Popen(['ngrok', 'http', '5000'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
| 55 |
-
|
| 56 |
-
logger.info("Ngrok is running in the background.")
|
| 57 |
-
|
| 58 |
-
|
| 59 |
class EndpointHandler:
|
| 60 |
def __init__(self, path=""):
|
| 61 |
self.pipe = FluxPipeline.from_pretrained(
|
|
@@ -71,6 +66,9 @@ class EndpointHandler:
|
|
| 71 |
)
|
| 72 |
# ngrok
|
| 73 |
self.public_url = ngrok.connect(5000).public_url
|
|
|
|
|
|
|
|
|
|
| 74 |
|
| 75 |
|
| 76 |
def __call__(self, data: Dict[str, Any]) -> str:
|
|
|
|
| 40 |
|
| 41 |
authtoken = "2cvqFKWc1eb9b0aN7pRLDUBfEtC_2FUehxFL8CAKXRkW3Hfjo"
|
| 42 |
commands = [
|
| 43 |
+
# "snap install ngrok",
|
| 44 |
f"ngrok config add-authtoken {authtoken}"
|
| 45 |
]
|
| 46 |
for command in commands:
|
|
|
|
| 51 |
logger.info(f"Failed CMD: {e}")
|
| 52 |
|
| 53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
class EndpointHandler:
|
| 55 |
def __init__(self, path=""):
|
| 56 |
self.pipe = FluxPipeline.from_pretrained(
|
|
|
|
| 66 |
)
|
| 67 |
# ngrok
|
| 68 |
self.public_url = ngrok.connect(5000).public_url
|
| 69 |
+
subprocess.Popen(['ngrok', 'http', '5000'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
| 70 |
+
|
| 71 |
+
logger.info("Ngrok is running in the background.")
|
| 72 |
|
| 73 |
|
| 74 |
def __call__(self, data: Dict[str, Any]) -> str:
|