Ashley Wright commited on
Commit
aa65bc3
·
1 Parent(s): 584b6a4

Allow running in any directory

Browse files
Files changed (1) hide show
  1. src/main.py +3 -2
src/main.py CHANGED
@@ -1,13 +1,14 @@
1
  from io import BytesIO
2
  from multiprocessing.connection import Listener
3
  from os import chmod
 
4
 
5
  from PIL.JpegImagePlugin import JpegImageFile
6
  from pipelines.models import TextToImageRequest
7
 
8
  from pipeline import load_pipeline, infer
9
 
10
- SOCKET = "/sandbox/inferences.sock"
11
 
12
 
13
  def main():
@@ -16,7 +17,7 @@ def main():
16
 
17
  print(f"Pipeline loaded")
18
 
19
- with Listener(SOCKET) as listener:
20
  chmod(SOCKET, 0o777)
21
 
22
  print(f"Awaiting connections")
 
1
  from io import BytesIO
2
  from multiprocessing.connection import Listener
3
  from os import chmod
4
+ from pathlib import Path
5
 
6
  from PIL.JpegImagePlugin import JpegImageFile
7
  from pipelines.models import TextToImageRequest
8
 
9
  from pipeline import load_pipeline, infer
10
 
11
+ SOCKET = Path(__file__).parent / "inferences.sock"
12
 
13
 
14
  def main():
 
17
 
18
  print(f"Pipeline loaded")
19
 
20
+ with Listener(str(SOCKET)) as listener:
21
  chmod(SOCKET, 0o777)
22
 
23
  print(f"Awaiting connections")