Spaces:
Runtime error
Runtime error
final touches
Browse files- .gitignore +2 -1
- __pycache__/commands.cpython-310.pyc +0 -0
- __pycache__/constants.cpython-310.pyc +0 -0
- app.py +11 -6
- constants.py +4 -4
- flagged/log.csv +24 -0
.gitignore
CHANGED
@@ -1,2 +1,3 @@
|
|
1 |
.env
|
2 |
-
__pycahe__
|
|
|
|
1 |
.env
|
2 |
+
__pycahe__/
|
3 |
+
flagged/
|
__pycache__/commands.cpython-310.pyc
ADDED
Binary file (1.47 kB). View file
|
|
__pycache__/constants.cpython-310.pyc
ADDED
Binary file (1.1 kB). View file
|
|
app.py
CHANGED
@@ -29,16 +29,21 @@ def transcribe(audio, text):
|
|
29 |
result = get_command(text, MODEL, id2label)
|
30 |
return "Text provided by the user", text_respnses[result], None
|
31 |
|
|
|
|
|
|
|
|
|
32 |
# Downsample original frequency to 16000hrz
|
33 |
-
input, rate = librosa.load(audio, sr=16000)
|
34 |
|
35 |
# getting text transcription
|
36 |
-
inputs = processor(input, sampling_rate=rate, return_tensors="pt")
|
37 |
-
generated_ids = model.generate(
|
38 |
-
|
39 |
-
)
|
|
|
|
|
40 |
|
41 |
-
transcription = processor.batch_decode(generated_ids, skip_special_tokens=True)
|
42 |
result = get_command(transcription, MODEL, id2label)
|
43 |
audio_res = resoponses.get(result)()
|
44 |
|
|
|
29 |
result = get_command(text, MODEL, id2label)
|
30 |
return "Text provided by the user", text_respnses[result], None
|
31 |
|
32 |
+
# getting text transcription
|
33 |
+
audio_file = open(audio, "rb")
|
34 |
+
transcription = openai.Audio.transcribe("whisper-1", audio_file, language="en")
|
35 |
+
transcription = transcription["text"]
|
36 |
# Downsample original frequency to 16000hrz
|
37 |
+
# input, rate = librosa.load(audio, sr=16000)
|
38 |
|
39 |
# getting text transcription
|
40 |
+
# inputs = processor(input, sampling_rate=rate, return_tensors="pt")
|
41 |
+
# generated_ids = model.generate(
|
42 |
+
# inputs["input_features"], attention_mask=inputs["attention_mask"]
|
43 |
+
# )
|
44 |
+
|
45 |
+
# transcription = processor.batch_decode(generated_ids, skip_special_tokens=True)
|
46 |
|
|
|
47 |
result = get_command(transcription, MODEL, id2label)
|
48 |
audio_res = resoponses.get(result)()
|
49 |
|
constants.py
CHANGED
@@ -37,8 +37,8 @@ text_respnses = {
|
|
37 |
"cooled_seats_off": "Cooled seats deactivated",
|
38 |
}
|
39 |
|
40 |
-
model = Speech2TextForConditionalGeneration.from_pretrained(
|
41 |
-
|
42 |
-
)
|
43 |
|
44 |
-
processor = Speech2TextProcessor.from_pretrained("facebook/s2t-small-librispeech-asr")
|
|
|
37 |
"cooled_seats_off": "Cooled seats deactivated",
|
38 |
}
|
39 |
|
40 |
+
# model = Speech2TextForConditionalGeneration.from_pretrained(
|
41 |
+
# "facebook/s2t-small-librispeech-asr"
|
42 |
+
# )
|
43 |
|
44 |
+
# processor = Speech2TextProcessor.from_pretrained("facebook/s2t-small-librispeech-asr")
|
flagged/log.csv
CHANGED
@@ -7,3 +7,27 @@ C:\Users\admin\Desktop\DS JRP\Programming\Python\Portfolio\Voice_Commands\flagge
|
|
7 |
,my neck need no more heating,,,2023-02-19 19:29:16.234959
|
8 |
C:\Users\admin\Desktop\DS JRP\Programming\Python\Portfolio\Voice_Commands\flagged\component 0\tmp7zfrxwn1.wav,,,,2023-02-19 20:28:51.150010
|
9 |
C:\Users\admin\Desktop\DS JRP\Programming\Python\Portfolio\Voice_Commands\flagged\component 0\tmpj9jcosbt.wav,,,,2023-02-19 20:29:16.601422
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
,my neck need no more heating,,,2023-02-19 19:29:16.234959
|
8 |
C:\Users\admin\Desktop\DS JRP\Programming\Python\Portfolio\Voice_Commands\flagged\component 0\tmp7zfrxwn1.wav,,,,2023-02-19 20:28:51.150010
|
9 |
C:\Users\admin\Desktop\DS JRP\Programming\Python\Portfolio\Voice_Commands\flagged\component 0\tmpj9jcosbt.wav,,,,2023-02-19 20:29:16.601422
|
10 |
+
/home/boumaza/Desktop/Programming/Python/Voice_Commands/flagged/component 0/tmpgp91h4bs.wav,,,,2023-03-03 10:48:05.204488
|
11 |
+
/home/boumaza/Desktop/Programming/Python/Voice_Commands/flagged/component 0/tmpzxnv34e9.wav,,,,2023-03-03 11:00:04.470118
|
12 |
+
/home/boumaza/Desktop/Programming/Python/Voice_Commands/flagged/component 0/tmp293krtcc.wav,,,,2023-03-03 11:05:18.409853
|
13 |
+
/home/boumaza/Desktop/Programming/Python/Voice_Commands/flagged/component 0/tmp8w_dg0my.wav,,,,2023-03-03 11:06:13.151883
|
14 |
+
/home/boumaza/Desktop/Programming/Python/Voice_Commands/flagged/component 0/tmp8uwv1dlh.wav,,,,2023-03-03 11:08:34.437979
|
15 |
+
,,,,2023-03-03 11:09:59.046011
|
16 |
+
/home/boumaza/Desktop/Programming/Python/Voice_Commands/flagged/component 0/tmpwerjyrhm.wav,,,,2023-03-03 11:10:14.290251
|
17 |
+
/home/boumaza/Desktop/Programming/Python/Voice_Commands/flagged/component 0/tmp1msp3gk7.wav,,,,2023-03-03 11:11:04.122287
|
18 |
+
/home/boumaza/Desktop/Programming/Python/Voice_Commands/flagged/component 0/tmpic0klrj5.wav,,,,2023-03-03 11:11:17.671385
|
19 |
+
/home/boumaza/Desktop/Programming/Python/Voice_Commands/flagged/component 0/tmpvb2y2kk5.wav,,,,2023-03-03 11:11:31.502951
|
20 |
+
/home/boumaza/Desktop/Programming/Python/Voice_Commands/flagged/component 0/tmp_sv03ta9.wav,,,,2023-03-03 11:11:52.200257
|
21 |
+
/home/boumaza/Desktop/Programming/Python/Voice_Commands/flagged/component 0/tmpl6bjw0sw.wav,,,,2023-03-03 11:17:37.575339
|
22 |
+
/home/boumaza/Desktop/Programming/Python/Voice_Commands/flagged/component 0/tmp7272239u.wav,,,,2023-03-03 11:18:02.333990
|
23 |
+
/home/boumaza/Desktop/Programming/Python/Voice_Commands/flagged/component 0/tmp4fwibr34.wav,,,,2023-03-03 11:18:18.551143
|
24 |
+
/home/boumaza/Desktop/Programming/Python/Voice_Commands/flagged/component 0/tmp3qcgcacy.wav,,,,2023-03-03 11:18:35.923342
|
25 |
+
/home/boumaza/Desktop/Programming/Python/Voice_Commands/flagged/component 0/tmplih8n03h.wav,,,,2023-03-03 11:51:57.253346
|
26 |
+
/home/boumaza/Desktop/Programming/Python/Voice_Commands/flagged/component 0/tmpx7nz_jih.wav,,,,2023-03-03 11:52:11.455135
|
27 |
+
/home/boumaza/Desktop/Programming/Python/Voice_Commands/flagged/component 0/tmpflbx1ja4.wav,,,,2023-03-03 11:52:28.437100
|
28 |
+
/home/boumaza/Desktop/Programming/Python/Voice_Commands/flagged/component 0/tmpcrult4_q.wav,,,,2023-03-03 11:52:39.450544
|
29 |
+
/home/boumaza/Desktop/Programming/Python/Voice_Commands/flagged/component 0/tmps1x6dtf2.wav,,,,2023-03-03 11:53:52.432486
|
30 |
+
/home/boumaza/Desktop/Programming/Python/Voice_Commands/flagged/component 0/tmp_sseh3hk.wav,,,,2023-03-03 11:54:09.292486
|
31 |
+
/home/boumaza/Desktop/Programming/Python/Voice_Commands/flagged/component 0/tmp68h39ev5.wav,,,,2023-03-03 11:54:26.488504
|
32 |
+
,I'm cold,,,2023-03-04 10:42:40.559129
|
33 |
+
,I'm cold,,,2023-03-04 10:44:49.418487
|