Josedcape commited on
Commit
3e27ec8
·
verified ·
1 Parent(s): 83a34e0

Upload 2 files

Browse files
Files changed (2) hide show
  1. audio_recorder.html +57 -0
  2. requirements (1).txt +64 -0
audio_recorder.html ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <title>Audio Recorder</title>
6
+ </head>
7
+ <body>
8
+ <button id="startRecording" onclick="startRecording()">Start Recording</button>
9
+ <button id="stopRecording" onclick="stopRecording()" disabled>Stop Recording</button>
10
+ <script>
11
+ let mediaRecorder;
12
+ let audioChunks = [];
13
+
14
+ function startRecording() {
15
+ navigator.mediaDevices.getUserMedia({ audio: true })
16
+ .then(stream => {
17
+ mediaRecorder = new MediaRecorder(stream);
18
+ mediaRecorder.start();
19
+
20
+ mediaRecorder.addEventListener("dataavailable", event => {
21
+ audioChunks.push(event.data);
22
+ });
23
+
24
+ mediaRecorder.addEventListener("stop", () => {
25
+ const audioBlob = new Blob(audioChunks);
26
+ audioChunks = [];
27
+ const reader = new FileReader();
28
+ reader.readAsDataURL(audioBlob);
29
+ reader.onloadend = () => {
30
+ const base64AudioMessage = reader.result.split(',')[1];
31
+ fetch('/process_audio', {
32
+ method: 'POST',
33
+ headers: {
34
+ 'Content-Type': 'application/json'
35
+ },
36
+ body: JSON.stringify({ audio_data: base64AudioMessage })
37
+ }).then(response => response.json())
38
+ .then(data => {
39
+ const event = new CustomEvent('audioTranscription', { detail: data.transcription });
40
+ document.dispatchEvent(event);
41
+ });
42
+ };
43
+ });
44
+
45
+ document.getElementById("startRecording").disabled = true;
46
+ document.getElementById("stopRecording").disabled = false;
47
+ });
48
+ }
49
+
50
+ function stopRecording() {
51
+ mediaRecorder.stop();
52
+ document.getElementById("startRecording").disabled = false;
53
+ document.getElementById("stopRecording").disabled = true;
54
+ }
55
+ </script>
56
+ </body>
57
+ </html>
requirements (1).txt ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ altair==5.3.0
2
+ annotated-types==0.6.0
3
+ anyio==4.3.0
4
+ attrs==23.2.0
5
+ blinker==1.7.0
6
+ cachetools==5.3.3
7
+ certifi==2024.2.2
8
+ charset-normalizer==3.3.2
9
+ click==8.1.7
10
+ distro==1.9.0
11
+ exceptiongroup==1.2.0
12
+ gitdb==4.0.11
13
+ GitPython==3.1.43
14
+ h11==0.14.0
15
+ httpcore==1.0.5
16
+ httpx==0.27.0
17
+ idna==3.6
18
+ Jinja2==3.1.3
19
+ joblib==1.3.2
20
+ jsonschema==4.21.1
21
+ jsonschema-specifications==2023.12.1
22
+ markdown-it-py==3.0.0
23
+ MarkupSafe==2.1.5
24
+ mdurl==0.1.2
25
+ nltk==3.8.1
26
+ numpy==1.26.4
27
+ openai==0.28
28
+ packaging==23.2
29
+ pandas==2.2.1
30
+ pillow==10.3.0
31
+ protobuf==4.25.3
32
+ pyarrow==15.0.2
33
+ pydantic==2.6.4
34
+ pydantic_core==2.16.3
35
+ pydeck==0.8.1b0
36
+ Pygments==2.17.2
37
+ PyPDF2==3.0.1
38
+ python-dateutil==2.9.0.post0
39
+ python-docx==0.8.11
40
+ pytz==2024.1
41
+ referencing==0.34.0
42
+ regex==2023.12.25
43
+ requests==2.31.0
44
+ rich==13.7.1
45
+ rpds-py==0.18.0
46
+ six==1.16.0
47
+ smmap==5.0.1
48
+ sniffio==1.3.1
49
+ streamlit==1.32.2
50
+ tenacity==8.2.3
51
+ toml==0.10.2
52
+ toolz==0.12.1
53
+ tornado==6.4
54
+ tqdm==4.66.2
55
+ typing_extensions==4.10.0
56
+ tzdata==2024.1
57
+ urllib3==2.2.1
58
+ watchdog==4.0.0
59
+ transformers==4.25.1
60
+ torch==2.0.1
61
+ fpdf==1.7.2
62
+ SpeechRecognition==3.10.4
63
+ google-cloud-texttospeech==2.16.3
64
+ Flask==3.0.3