Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -21,15 +21,15 @@ def load_audio(file: str, sr: int = SAMPLE_RATE):
|
|
21 |
|
22 |
return np.frombuffer(out, np.int16).flatten().astype(np.float32) / 32768.0
|
23 |
if 'processor' not in locals():
|
24 |
-
processor = AutoProcessor.from_pretrained("openai/whisper-
|
25 |
-
model = AutoModelForSpeechSeq2Seq.from_pretrained("openai/whisper-
|
26 |
|
27 |
|
28 |
|
29 |
pipe = pipeline('sentiment-analysis')
|
30 |
#pipe2 = pipeline(task="image-bestify", model="beihai/GFPGAN-V1.3-whole-image")
|
31 |
text = st.text_area('entre com algum texto')
|
32 |
-
st.title("
|
33 |
|
34 |
wav_up = st.file_uploader("Upload a hot dog candidate image",type=['wav'])
|
35 |
|
@@ -52,8 +52,13 @@ if wav_up is not None:
|
|
52 |
forced_decoder_ids = processor.get_decoder_prompt_ids(language = None, task = "transcribe")
|
53 |
|
54 |
predicted_ids = model.generate(input_features, forced_decoder_ids = forced_decoder_ids)
|
55 |
-
|
|
|
|
|
|
|
|
|
56 |
st.json(transcription )
|
|
|
57 |
print('3')
|
58 |
if text:
|
59 |
out=pipe(text)
|
|
|
21 |
|
22 |
return np.frombuffer(out, np.int16).flatten().astype(np.float32) / 32768.0
|
23 |
if 'processor' not in locals():
|
24 |
+
processor = AutoProcessor.from_pretrained("openai/whisper-small")
|
25 |
+
model = AutoModelForSpeechSeq2Seq.from_pretrained("openai/whisper-small")
|
26 |
|
27 |
|
28 |
|
29 |
pipe = pipeline('sentiment-analysis')
|
30 |
#pipe2 = pipeline(task="image-bestify", model="beihai/GFPGAN-V1.3-whole-image")
|
31 |
text = st.text_area('entre com algum texto')
|
32 |
+
st.title("Wav a ser transcrito ")
|
33 |
|
34 |
wav_up = st.file_uploader("Upload a hot dog candidate image",type=['wav'])
|
35 |
|
|
|
52 |
forced_decoder_ids = processor.get_decoder_prompt_ids(language = None, task = "transcribe")
|
53 |
|
54 |
predicted_ids = model.generate(input_features, forced_decoder_ids = forced_decoder_ids)
|
55 |
+
i=0
|
56 |
+
while i<2
|
57 |
+
|
58 |
+
|
59 |
+
transcription = processor.batch_decode(predicted_ids, skip_special_tokens = True)
|
60 |
st.json(transcription )
|
61 |
+
i=i+1
|
62 |
print('3')
|
63 |
if text:
|
64 |
out=pipe(text)
|