Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -7,6 +7,7 @@ nltk.download("punkt")
|
|
7 |
from transformers import pipeline
|
8 |
import scipy.io.wavfile
|
9 |
import soundfile as sf
|
|
|
10 |
|
11 |
model_name = "Shubham09/whisper31filescheck"
|
12 |
processor = WhisperProcessor.from_pretrained(model_name,task="transcribe")
|
@@ -28,6 +29,13 @@ def load_data(input_file):
|
|
28 |
def write_to_file(input_file):
|
29 |
fs = 16000
|
30 |
sf.write("my_Audio_file.flac",input_file, fs)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
|
32 |
|
33 |
|
@@ -39,14 +47,12 @@ def write_to_file(input_file):
|
|
39 |
# decode_string = base64.b64decode(input_file)
|
40 |
# wav_file.write(decode_string)
|
41 |
|
42 |
-
# def correct_casing(input_sentence):
|
43 |
|
44 |
-
|
45 |
-
# return (' '.join([s.replace(s[0],s[0].capitalize(),1) for s in sentences]))
|
46 |
pipe = pipeline(model="Shubham09/whisper31filescheck") # change to "your-username/the-name-you-picked"
|
47 |
|
48 |
def asr_transcript(audio):
|
49 |
-
audio = "my_Audio_file.flac"
|
50 |
text = pipe(audio)["text"]
|
51 |
return text
|
52 |
|
|
|
7 |
from transformers import pipeline
|
8 |
import scipy.io.wavfile
|
9 |
import soundfile as sf
|
10 |
+
from huggingface_hub import HfApi, CommitOperationAdd, CommitOperationDelete
|
11 |
|
12 |
model_name = "Shubham09/whisper31filescheck"
|
13 |
processor = WhisperProcessor.from_pretrained(model_name,task="transcribe")
|
|
|
29 |
def write_to_file(input_file):
|
30 |
fs = 16000
|
31 |
sf.write("my_Audio_file.flac",input_file, fs)
|
32 |
+
api = HfApi()
|
33 |
+
operations = [
|
34 |
+
CommitOperationAdd(path_in_repo="my_Audio_file.flac", path_or_fileobj="~/repo/my_Audio_file.flac"),
|
35 |
+
# CommitOperationAdd(path_in_repo="weights.h5", path_or_fileobj="~/repo/weights-final.h5"),
|
36 |
+
# CommitOperationDelete(path_in_repo="old-weights.h5"),
|
37 |
+
# CommitOperationDelete(path_in_repo="logs/"),
|
38 |
+
]
|
39 |
|
40 |
|
41 |
|
|
|
47 |
# decode_string = base64.b64decode(input_file)
|
48 |
# wav_file.write(decode_string)
|
49 |
|
|
|
50 |
|
51 |
+
|
|
|
52 |
pipe = pipeline(model="Shubham09/whisper31filescheck") # change to "your-username/the-name-you-picked"
|
53 |
|
54 |
def asr_transcript(audio):
|
55 |
+
audio = "~/repo/my_Audio_file.flac"
|
56 |
text = pipe(audio)["text"]
|
57 |
return text
|
58 |
|