HypermindLabs commited on
Commit
6f7d7a7
·
1 Parent(s): e2c4c0e

big update

Browse files
Files changed (1) hide show
  1. app.py +3 -11
app.py CHANGED
@@ -17,24 +17,15 @@ import librosa
17
 
18
  # MODEL LOADING and INITIALISATION
19
 
20
- endReached = False
21
-
22
- s=0
23
- n=16000
24
-
25
- @st.cache_resource()
26
  def load_model():
27
  model = torch.jit.load("snorenetv1_small.ptl")
28
  model.eval()
29
  return model
30
- # model = load_model()
 
31
 
32
- if "model" not in st.session_state.keys():
33
- st.session_state["model"] = load_model()
34
- model = st.session_state["model"]
35
  # Audio parameters
36
  def process_data(waveform_chunks):
37
-
38
  snore = 0
39
  other = 0
40
  st.write("Reached stage 4")
@@ -44,6 +35,7 @@ def process_data(waveform_chunks):
44
  st.write("Reached stage 6")
45
  st.write(input_tensor.shape)
46
  result = model(input_tensor)
 
47
  st.write(result)
48
  if np.abs(result[0][0]) > np.abs(result[0][1]):
49
  other += 1
 
17
 
18
  # MODEL LOADING and INITIALISATION
19
 
 
 
 
 
 
 
20
  def load_model():
21
  model = torch.jit.load("snorenetv1_small.ptl")
22
  model.eval()
23
  return model
24
+ model = load_model()
25
+
26
 
 
 
 
27
  # Audio parameters
28
  def process_data(waveform_chunks):
 
29
  snore = 0
30
  other = 0
31
  st.write("Reached stage 4")
 
35
  st.write("Reached stage 6")
36
  st.write(input_tensor.shape)
37
  result = model(input_tensor)
38
+ time.sleep(3)
39
  st.write(result)
40
  if np.abs(result[0][0]) > np.abs(result[0][1]):
41
  other += 1