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

Updated for unix support

Browse files
Files changed (1) hide show
  1. app.py +15 -1
app.py CHANGED
@@ -5,9 +5,23 @@ import librosa.display
5
  import matplotlib.pyplot as plt
6
  import numpy as np
7
  import os
 
8
 
9
  # Load your fastai model
10
- learn_inf = load_learner('export.pkl')
 
 
 
 
 
 
 
 
 
 
 
 
 
11
 
12
  # Function to save mel spectrogram and run inference
13
  def save_mel_spectrogram_and_predict(wav_path):
 
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):