mirsaid5455 commited on
Commit
f5c1c15
1 Parent(s): dd546a9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -4,24 +4,24 @@ from PIL import Image
4
  import numpy as np
5
  import pathlib
6
 
 
 
 
 
 
 
 
 
7
 
8
  # Temporary fix for pathlib.PosixPath on Windows
9
  # temp = pathlib.PosixPath
10
  # pathlib.PosixPath = pathlib.WindowsPath
11
 
12
- # Check if the system is Windows to decide which pathlib to use
13
- if platform.system() == "Windows":
14
- temp = pathlib.PosixPath
15
- pathlib.PosixPath = pathlib.WindowsPath
16
-
17
 
18
  # Load the Fastai Learner model
19
  learn = load_learner('model.pkl')
20
  learn_xray = load_learner("xraydet.pkl")
21
 
22
- # Restore pathlib to original state if it was modified
23
- if platform.system() == "Windows":
24
- pathlib.PosixPath = temp
25
 
26
  def process_image(image):
27
  try:
 
4
  import numpy as np
5
  import pathlib
6
 
7
+ import pathlib
8
+ import platform
9
+
10
+ plt = platform.system()
11
+ st.write(plt) # just for debugging
12
+ if plt == 'Linux':
13
+ pathlib.PosixPath = pathlib.WindowsPath # or maybe the other way round
14
+
15
 
16
  # Temporary fix for pathlib.PosixPath on Windows
17
  # temp = pathlib.PosixPath
18
  # pathlib.PosixPath = pathlib.WindowsPath
19
 
 
 
 
 
 
20
 
21
  # Load the Fastai Learner model
22
  learn = load_learner('model.pkl')
23
  learn_xray = load_learner("xraydet.pkl")
24
 
 
 
 
25
 
26
  def process_image(image):
27
  try: