huedaya commited on
Commit
c0cca0a
1 Parent(s): b03e1fb
Files changed (1) hide show
  1. app.py +5 -6
app.py CHANGED
@@ -8,7 +8,7 @@ import streamlit as st
8
 
9
 
10
 
11
- model = whisper.load_model('small')
12
 
13
  app = Flask(__name__)
14
 
@@ -20,8 +20,8 @@ def indexApi():
20
  def runApi():
21
  audio_url = request.form.get("audio_url")
22
  # key = request.form.get("key")
23
- modelSelection = request.form.get("model")
24
- print(audio_url)
25
 
26
  # if (modelSelection == None):
27
  # modelSelection = "small"
@@ -41,7 +41,6 @@ def runApi():
41
  response = requests.get(audio_url)
42
 
43
  if response.status_code == requests.codes.ok:
44
- # Only attempt to save the file if the request was successful
45
  with open("audio.mp3", "wb") as f:
46
  f.write(response.content)
47
 
@@ -63,11 +62,11 @@ def runApi():
63
 
64
  options = whisper.DecodingOptions(fp16 = False)
65
  result = whisper.decode(model, mel, options)
66
-
67
  return jsonify({
68
  "audio_url": audio_url,
69
  "model": model,
70
- "result": result.text,
71
  })
72
 
73
  if __name__ == "__main__":
 
8
 
9
 
10
 
11
+ model = whisper.load_model("small")
12
 
13
  app = Flask(__name__)
14
 
 
20
  def runApi():
21
  audio_url = request.form.get("audio_url")
22
  # key = request.form.get("key")
23
+ # modelSelection = request.form.get("model")
24
+ # print(audio_url)
25
 
26
  # if (modelSelection == None):
27
  # modelSelection = "small"
 
41
  response = requests.get(audio_url)
42
 
43
  if response.status_code == requests.codes.ok:
 
44
  with open("audio.mp3", "wb") as f:
45
  f.write(response.content)
46
 
 
62
 
63
  options = whisper.DecodingOptions(fp16 = False)
64
  result = whisper.decode(model, mel, options)
65
+ print(result.text)
66
  return jsonify({
67
  "audio_url": audio_url,
68
  "model": model,
69
+ # "result": result.text,
70
  })
71
 
72
  if __name__ == "__main__":