Comment out Whisper functionality
Browse files- app.py +26 -33
- videos/tempfile.mp4 +2 -2
app.py
CHANGED
|
@@ -5,8 +5,9 @@ import datetime
|
|
| 5 |
import gradio as gr
|
| 6 |
import requests
|
| 7 |
|
| 8 |
-
|
| 9 |
-
import
|
|
|
|
| 10 |
|
| 11 |
from langchain import ConversationChain
|
| 12 |
|
|
@@ -17,35 +18,26 @@ from langchain.llms import OpenAI
|
|
| 17 |
news_api_key = os.environ["NEWS_API_KEY"]
|
| 18 |
tmdb_bearer_token = os.environ["TMDB_BEARER_TOKEN"]
|
| 19 |
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
|
|
|
| 23 |
|
| 24 |
|
| 25 |
-
def transcribe(aud_inp):
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
# decode the audio
|
| 40 |
-
options = whisper.DecodingOptions()
|
| 41 |
-
result = whisper.decode(WHISPER_MODEL, mel, options)
|
| 42 |
-
|
| 43 |
-
print("result.text", result.text)
|
| 44 |
-
|
| 45 |
-
result_text = ""
|
| 46 |
-
if result and result.text:
|
| 47 |
-
result_text = result.text
|
| 48 |
-
return result_text
|
| 49 |
|
| 50 |
|
| 51 |
def load_chain():
|
|
@@ -143,10 +135,11 @@ with block:
|
|
| 143 |
lines=1)
|
| 144 |
submit = gr.Button(value="Send", variant="secondary").style(full_width=False)
|
| 145 |
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
|
|
|
| 150 |
|
| 151 |
gr.Examples(
|
| 152 |
examples=["How many people live in Canada?",
|
|
|
|
| 5 |
import gradio as gr
|
| 6 |
import requests
|
| 7 |
|
| 8 |
+
# UNCOMMENT TO USE WHISPER
|
| 9 |
+
# import warnings
|
| 10 |
+
# import whisper
|
| 11 |
|
| 12 |
from langchain import ConversationChain
|
| 13 |
|
|
|
|
| 18 |
news_api_key = os.environ["NEWS_API_KEY"]
|
| 19 |
tmdb_bearer_token = os.environ["TMDB_BEARER_TOKEN"]
|
| 20 |
|
| 21 |
+
# UNCOMMENT TO USE WHISPER
|
| 22 |
+
# warnings.filterwarnings("ignore")
|
| 23 |
+
# WHISPER_MODEL = whisper.load_model("tiny")
|
| 24 |
+
# print("WHISPER_MODEL", WHISPER_MODEL)
|
| 25 |
|
| 26 |
|
| 27 |
+
# def transcribe(aud_inp):
|
| 28 |
+
# if aud_inp is None:
|
| 29 |
+
# return ""
|
| 30 |
+
# aud = whisper.load_audio(aud_inp)
|
| 31 |
+
# aud = whisper.pad_or_trim(aud)
|
| 32 |
+
# mel = whisper.log_mel_spectrogram(aud).to(WHISPER_MODEL.device)
|
| 33 |
+
# _, probs = WHISPER_MODEL.detect_language(mel)
|
| 34 |
+
# options = whisper.DecodingOptions()
|
| 35 |
+
# result = whisper.decode(WHISPER_MODEL, mel, options)
|
| 36 |
+
# print("result.text", result.text)
|
| 37 |
+
# result_text = ""
|
| 38 |
+
# if result and result.text:
|
| 39 |
+
# result_text = result.text
|
| 40 |
+
# return result_text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
|
| 42 |
|
| 43 |
def load_chain():
|
|
|
|
| 135 |
lines=1)
|
| 136 |
submit = gr.Button(value="Send", variant="secondary").style(full_width=False)
|
| 137 |
|
| 138 |
+
# UNCOMMENT TO USE WHISPER
|
| 139 |
+
# with gr.Row():
|
| 140 |
+
# audio_comp = gr.Microphone(source="microphone", type="filepath", label="Just say it!",
|
| 141 |
+
# interactive=True, streaming=False)
|
| 142 |
+
# audio_comp.change(transcribe, inputs=[audio_comp], outputs=[message])
|
| 143 |
|
| 144 |
gr.Examples(
|
| 145 |
examples=["How many people live in Canada?",
|
videos/tempfile.mp4
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7ad6ea94ca0de42304c461a30340e259f9943ef79c9aaa68d8eef2087ee398a6
|
| 3 |
+
size 135190
|