huedaya commited on
Commit
a7c2026
·
1 Parent(s): de6b9df
Files changed (1) hide show
  1. app.py +9 -2
app.py CHANGED
@@ -6,11 +6,13 @@ from flask import Flask, jsonify, request
6
  import requests
7
  import time
8
  from transformers import pipeline
 
9
 
10
- model = whisper.load_model("small.en")
 
11
  pipe = pipeline(
12
  "automatic-speech-recognition",
13
- model="openai/whisper-small",
14
  chunk_length_s=15,
15
  device=model.device,
16
  )
@@ -51,6 +53,11 @@ def runApi():
51
  options = whisper.DecodingOptions(fp16 = False)
52
  result = whisper.decode(model, mel, options)
53
 
 
 
 
 
 
54
  end_time = time.time()
55
  total_time = end_time - start_time
56
 
 
6
  import requests
7
  import time
8
  from transformers import pipeline
9
+ from datasets import load_dataset
10
 
11
+
12
+ model = whisper.load_model("small")
13
  pipe = pipeline(
14
  "automatic-speech-recognition",
15
+ model=model,
16
  chunk_length_s=15,
17
  device=model.device,
18
  )
 
53
  options = whisper.DecodingOptions(fp16 = False)
54
  result = whisper.decode(model, mel, options)
55
 
56
+ ds = load_dataset("hf-internal-testing/librispeech_asr_dummy", "clean", split="validation")
57
+ sample = ds[0]["audio"]
58
+ prediction = pipe(sample.copy())["text"]
59
+ print(prediction)
60
+
61
  end_time = time.time()
62
  total_time = end_time - start_time
63