HyperMind-Labs commited on
Commit
b0ee464
·
1 Parent(s): a557b10
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -52,8 +52,16 @@ with st.expander('About this App'):
52
  wav_audio_data = st_audiorec()
53
  if wav_audio_data is not None:
54
  np_wav = np.frombuffer(wav_audio_data, dtype=np.int16)
55
- input_tensor = torch.tensor(np_wav)
56
- st.write(input_tensor.shape)
 
 
 
 
 
 
 
 
57
  # PERCENTAGE OF SNORING PLOT
58
 
59
 
 
52
  wav_audio_data = st_audiorec()
53
  if wav_audio_data is not None:
54
  np_wav = np.frombuffer(wav_audio_data, dtype=np.int16)
55
+ wav_tensor = torch.tensor(np_wav, dtype=torch.float32)
56
+ segment_samples = int(RATE * 1)
57
+ num_segments = len(wav_tensor) // segment_samples
58
+ segments_list = []
59
+ for i in range(num_segments):
60
+ start_sample = i * segment_samples
61
+ end_sample = (i + 1) * segment_samples
62
+ segment = wav_tensor[start_sample:end_sample]
63
+ segments_list.append(segment)
64
+ st.write(segments_list)
65
  # PERCENTAGE OF SNORING PLOT
66
 
67