huedaya commited on
Commit
835eaac
1 Parent(s): c0cca0a
Files changed (2) hide show
  1. README.md +2 -2
  2. app.py +11 -4
README.md CHANGED
@@ -1,6 +1,6 @@
1
  ---
2
- title: Whisper
3
- emoji: 📉
4
  colorFrom: pink
5
  colorTo: yellow
6
  sdk: gradio
 
1
  ---
2
+ title: V-to-text
3
+ emoji: 🗣
4
  colorFrom: pink
5
  colorTo: yellow
6
  sdk: gradio
app.py CHANGED
@@ -5,7 +5,7 @@ import whisper
5
  from flask import Flask, jsonify, request
6
  import requests
7
  import streamlit as st
8
-
9
 
10
 
11
  model = whisper.load_model("small")
@@ -18,6 +18,8 @@ def indexApi():
18
 
19
  @app.route("/run", methods=['POST'])
20
  def runApi():
 
 
21
  audio_url = request.form.get("audio_url")
22
  # key = request.form.get("key")
23
  # modelSelection = request.form.get("model")
@@ -62,11 +64,16 @@ def runApi():
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__":
 
5
  from flask import Flask, jsonify, request
6
  import requests
7
  import streamlit as st
8
+ import time
9
 
10
 
11
  model = whisper.load_model("small")
 
18
 
19
  @app.route("/run", methods=['POST'])
20
  def runApi():
21
+ start_time = time.time()
22
+
23
  audio_url = request.form.get("audio_url")
24
  # key = request.form.get("key")
25
  # modelSelection = request.form.get("model")
 
64
 
65
  options = whisper.DecodingOptions(fp16 = False)
66
  result = whisper.decode(model, mel, options)
67
+
68
+
69
+ end_time = time.time()
70
+ total_time = end_time - start_time
71
+
72
  return jsonify({
73
  "audio_url": audio_url,
74
+ # "model": model,
75
+ "result": result.text,
76
+ "exec_time_sec": total_time
77
  })
78
 
79
  if __name__ == "__main__":