joshieyu commited on
Commit
f03c7c1
·
1 Parent(s): 15d3f8d

Tried fixing unix stuff

Browse files
Files changed (1) hide show
  1. app.py +9 -14
app.py CHANGED
@@ -5,23 +5,18 @@ import librosa.display
5
  import matplotlib.pyplot as plt
6
  import numpy as np
7
  import os
8
- from pathlib import Path, PureWindowsPath
9
-
10
- # Load your fastai model
11
- def load_model(path):
12
- if os.name == 'nt':
13
- # For Windows
14
- learn_inf = load_learner(path)
15
- else:
16
- # For Unix
17
- path = Path(path)
18
- path = path.as_posix() # Convert to POSIX path
19
- learn_inf = load_learner(path)
20
- return learn_inf
21
 
 
 
 
 
 
 
22
 
23
  # Load your fastai model
24
- learn_inf = load_model('export.pkl')
 
25
 
26
  # Function to save mel spectrogram and run inference
27
  def save_mel_spectrogram_and_predict(wav_path):
 
5
  import matplotlib.pyplot as plt
6
  import numpy as np
7
  import os
8
+ import pathlib
 
 
 
 
 
 
 
 
 
 
 
 
9
 
10
+ if os.name != 'nt':
11
+ pathlib.WindowsPath = pathlib.PosixPath
12
+ # For Windows
13
+ # learn_inf = load_learner('export.pkl')
14
+ # else:
15
+ # learn_inf = load_learner('export.pkl')
16
 
17
  # Load your fastai model
18
+ learn_inf = load_learner('export.pkl')
19
+
20
 
21
  # Function to save mel spectrogram and run inference
22
  def save_mel_spectrogram_and_predict(wav_path):