Spaces:
Running
Running
Commit
·
bb47424
1
Parent(s):
2482910
get model from huggingface-hub
Browse files- app.py +9 -17
- requirements.txt +1 -0
app.py
CHANGED
|
@@ -27,22 +27,14 @@ def process_cat_embs(cat_embs):
|
|
| 27 |
|
| 28 |
|
| 29 |
def download_rev_models():
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
# )
|
| 39 |
-
model_path = "/Users/natalie/NERD-2941/reginald/10.jit.zip"
|
| 40 |
-
units_path = "/Users/natalie/NERD-2941/reginald/tk.units.txt"
|
| 41 |
-
audio_path = "/Users/natalie/NERD-2941/rev-wenet/runtime/web/fdhc0_si1559.wav"
|
| 42 |
-
cat_embs = "1,0"
|
| 43 |
-
device = "cpu"
|
| 44 |
-
cat_embs = process_cat_embs
|
| 45 |
-
model = load_model(model_path, units_path)
|
| 46 |
return model
|
| 47 |
|
| 48 |
model = download_rev_models()
|
|
@@ -66,7 +58,7 @@ def recognition(audio, style=0):
|
|
| 66 |
# input
|
| 67 |
inputs = [
|
| 68 |
gr.inputs.Audio(source="microphone", type="filepath", label='Input audio'),
|
| 69 |
-
gr.Slider(0, 1, value=0, label="Style", info="Choose between verbatim and NV"),
|
| 70 |
]
|
| 71 |
|
| 72 |
output = gr.outputs.Textbox(label="Output Text")
|
|
|
|
| 27 |
|
| 28 |
|
| 29 |
def download_rev_models():
|
| 30 |
+
from huggingface_hub import hf_hub_download
|
| 31 |
+
import joblib
|
| 32 |
+
|
| 33 |
+
REPO_ID = "Revai/reginald"
|
| 34 |
+
|
| 35 |
+
files = ['10.jit.zip', 'tk.units.txt']
|
| 36 |
+
downloaded_files = [hf_hub_download(repo_id=REPO_ID, filename=f) for f in files]
|
| 37 |
+
model = load_model(downloaded_files[0], downloaded_files[1])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
return model
|
| 39 |
|
| 40 |
model = download_rev_models()
|
|
|
|
| 58 |
# input
|
| 59 |
inputs = [
|
| 60 |
gr.inputs.Audio(source="microphone", type="filepath", label='Input audio'),
|
| 61 |
+
gr.Slider(0, 1, value=0, label="Style - from verbatim (0) to non-verbatim (1)", info="Choose between verbatim and NV"),
|
| 62 |
]
|
| 63 |
|
| 64 |
output = gr.outputs.Textbox(label="Output Text")
|
requirements.txt
CHANGED
|
@@ -1,2 +1,3 @@
|
|
| 1 |
wenet @ git+https://github.com/revdotcom/rev-wenet@feature/NERD-3007
|
| 2 |
gradio==3.14.0
|
|
|
|
|
|
| 1 |
wenet @ git+https://github.com/revdotcom/rev-wenet@feature/NERD-3007
|
| 2 |
gradio==3.14.0
|
| 3 |
+
huggingface-hub
|