infinity1096 commited on
Commit
8683722
·
1 Parent(s): 1b3abf3

hack on pip install -e

Browse files
Files changed (1) hide show
  1. app.py +9 -1
app.py CHANGED
@@ -8,12 +8,20 @@ from PIL import Image
8
  import sys
9
  import subprocess
10
 
 
 
 
 
11
  try:
12
  import uniception
13
  import uniflowmatch
14
- except:
15
  try:
16
  subprocess.check_call(["/bin/bash", "/home/user/app/install_package.sh"])
 
 
 
 
17
  except subprocess.CalledProcessError as e:
18
  print(f"Script failed with return code {e.returncode}", file=sys.stderr)
19
  sys.exit(e.returncode)
 
8
  import sys
9
  import subprocess
10
 
11
+ import sys
12
+ import subprocess
13
+ import importlib
14
+
15
  try:
16
  import uniception
17
  import uniflowmatch
18
+ except ImportError:
19
  try:
20
  subprocess.check_call(["/bin/bash", "/home/user/app/install_package.sh"])
21
+ # After successful install, reload sys.path and import modules
22
+ importlib.invalidate_caches()
23
+ uniception = importlib.import_module("uniception")
24
+ uniflowmatch = importlib.import_module("uniflowmatch")
25
  except subprocess.CalledProcessError as e:
26
  print(f"Script failed with return code {e.returncode}", file=sys.stderr)
27
  sys.exit(e.returncode)