Spaces:
Sleeping
Sleeping
Commit
·
87cf0bb
1
Parent(s):
48eebae
Update app.py
Browse files
app.py
CHANGED
|
@@ -11,51 +11,51 @@ if st.button("Analyze"):
|
|
| 11 |
st.write("Prediction:", result[0]['label'], "| Score:", result[0]['score'])
|
| 12 |
|
| 13 |
###
|
| 14 |
-
def recording_storing():
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
-
|
| 58 |
|
| 59 |
-
audio = recording_storing()
|
| 60 |
-
print(audio)
|
| 61 |
|
|
|
|
| 11 |
st.write("Prediction:", result[0]['label'], "| Score:", result[0]['score'])
|
| 12 |
|
| 13 |
###
|
| 14 |
+
# def recording_storing():
|
| 15 |
+
# chunk = 1024 # Record in chunks of 1024 samples
|
| 16 |
+
# sample_format = pyaudio.paInt16 # 16 bits per sample
|
| 17 |
+
# channels = 1
|
| 18 |
+
# fs = 44100 # Record at 44100 samples per second
|
| 19 |
+
# seconds = 4
|
| 20 |
+
# # filename = "output.wav"
|
| 21 |
+
|
| 22 |
+
# p = pyaudio.PyAudio() # Create an interface to PortAudio
|
| 23 |
+
|
| 24 |
+
# print('Recording')
|
| 25 |
+
|
| 26 |
+
# stream = p.open(format=sample_format,
|
| 27 |
+
# channels=channels,
|
| 28 |
+
# rate=fs,
|
| 29 |
+
# frames_per_buffer=chunk,
|
| 30 |
+
# input=True)
|
| 31 |
+
|
| 32 |
+
# frames = [] # Initialize array to store frames
|
| 33 |
+
|
| 34 |
+
# # Store data in chunks for 3 seconds
|
| 35 |
+
# for i in range(0, int(fs / chunk * seconds)):
|
| 36 |
+
# data = stream.read(chunk)
|
| 37 |
+
# frames.append(data)
|
| 38 |
+
|
| 39 |
+
# # Stop and close the stream
|
| 40 |
+
# stream.stop_stream()
|
| 41 |
+
# stream.close()
|
| 42 |
+
# # Terminate the PortAudio interface
|
| 43 |
+
# p.terminate()
|
| 44 |
+
|
| 45 |
+
# print('Finished recording')
|
| 46 |
+
|
| 47 |
+
# # Save the recorded data as a WAV file
|
| 48 |
+
# wf = wave.open(filename, 'wb')
|
| 49 |
+
# wf.setnchannels(channels)
|
| 50 |
+
# wf.setsampwidth(p.get_sample_size(sample_format))
|
| 51 |
+
# wf.setframerate(fs)
|
| 52 |
+
# wf.writeframes(b''.join(frames))
|
| 53 |
+
# wf.close()
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
+
# return "recorded"
|
| 58 |
|
| 59 |
+
# audio = recording_storing()
|
| 60 |
+
# print(audio)
|
| 61 |
|