Spaces:
Sleeping
Sleeping
update
Browse files
README.md
CHANGED
@@ -16,6 +16,7 @@ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-
|
|
16 |
docker build -t asr:v20240510_1734 .
|
17 |
|
18 |
docker run -itd --name ASR \
|
|
|
19 |
-v /data/tianxing/PycharmProjects/asr/data/:/home/user/app/data/ \
|
20 |
-v /data/tianxing/PycharmProjects/asr/pretrained_models/:/home/user/app/pretrained_models/ \
|
21 |
asr:v20240510_1734 /bin/bash
|
|
|
16 |
docker build -t asr:v20240510_1734 .
|
17 |
|
18 |
docker run -itd --name ASR \
|
19 |
+
--network host \
|
20 |
-v /data/tianxing/PycharmProjects/asr/data/:/home/user/app/data/ \
|
21 |
-v /data/tianxing/PycharmProjects/asr/pretrained_models/:/home/user/app/pretrained_models/ \
|
22 |
asr:v20240510_1734 /bin/bash
|
main.py
CHANGED
@@ -59,6 +59,16 @@ def process_uploaded_file(language: str,
|
|
59 |
return "Dummy", build_html_output("Dummy")
|
60 |
|
61 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
def main():
|
63 |
title = "# Automatic Speech Recognition with Next-gen Kaldi"
|
64 |
|
@@ -68,40 +78,39 @@ def main():
|
|
68 |
"Chinese": ["None"]
|
69 |
}
|
70 |
|
71 |
-
# components
|
72 |
-
language_radio = gr.Radio(
|
73 |
-
label="Language",
|
74 |
-
choices=language_choices,
|
75 |
-
value=language_choices[0],
|
76 |
-
)
|
77 |
-
model_dropdown = gr.Dropdown(
|
78 |
-
choices=language_to_models[language_choices[0]],
|
79 |
-
label="Select a model",
|
80 |
-
value=language_to_models[language_choices[0]][0],
|
81 |
-
)
|
82 |
-
decoding_method_radio = gr.Radio(
|
83 |
-
label="Decoding method",
|
84 |
-
choices=["greedy_search", "modified_beam_search"],
|
85 |
-
value="greedy_search",
|
86 |
-
)
|
87 |
-
num_active_paths_slider = gr.Slider(
|
88 |
-
minimum=1,
|
89 |
-
value=4,
|
90 |
-
step=1,
|
91 |
-
label="Number of active paths for modified_beam_search",
|
92 |
-
)
|
93 |
-
punct_radio = gr.Radio(
|
94 |
-
label="Whether to add punctuation (Only for Chinese and English)",
|
95 |
-
choices=["Yes", "No"],
|
96 |
-
value="Yes",
|
97 |
-
)
|
98 |
-
|
99 |
# blocks
|
100 |
-
with gr.Blocks() as blocks:
|
101 |
gr.Markdown(value=title)
|
102 |
|
103 |
with gr.Tabs():
|
104 |
with gr.TabItem("Upload from disk"):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
uploaded_file = gr.Audio(
|
106 |
sources=["upload"],
|
107 |
type="filepath",
|
|
|
59 |
return "Dummy", build_html_output("Dummy")
|
60 |
|
61 |
|
62 |
+
# css style is copied from
|
63 |
+
# https://huggingface.co/spaces/alphacep/asr/blob/main/app.py#L113
|
64 |
+
css = """
|
65 |
+
.result {display:flex;flex-direction:column}
|
66 |
+
.result_item {padding:15px;margin-bottom:8px;border-radius:15px;width:100%}
|
67 |
+
.result_item_success {background-color:mediumaquamarine;color:white;align-self:start}
|
68 |
+
.result_item_error {background-color:#ff7070;color:white;align-self:start}
|
69 |
+
"""
|
70 |
+
|
71 |
+
|
72 |
def main():
|
73 |
title = "# Automatic Speech Recognition with Next-gen Kaldi"
|
74 |
|
|
|
78 |
"Chinese": ["None"]
|
79 |
}
|
80 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
# blocks
|
82 |
+
with gr.Blocks(css=css) as blocks:
|
83 |
gr.Markdown(value=title)
|
84 |
|
85 |
with gr.Tabs():
|
86 |
with gr.TabItem("Upload from disk"):
|
87 |
+
language_radio = gr.Radio(
|
88 |
+
label="Language",
|
89 |
+
choices=language_choices,
|
90 |
+
value=language_choices[0],
|
91 |
+
)
|
92 |
+
model_dropdown = gr.Dropdown(
|
93 |
+
choices=language_to_models[language_choices[0]],
|
94 |
+
label="Select a model",
|
95 |
+
value=language_to_models[language_choices[0]][0],
|
96 |
+
)
|
97 |
+
decoding_method_radio = gr.Radio(
|
98 |
+
label="Decoding method",
|
99 |
+
choices=["greedy_search", "modified_beam_search"],
|
100 |
+
value="greedy_search",
|
101 |
+
)
|
102 |
+
num_active_paths_slider = gr.Slider(
|
103 |
+
minimum=1,
|
104 |
+
value=4,
|
105 |
+
step=1,
|
106 |
+
label="Number of active paths for modified_beam_search",
|
107 |
+
)
|
108 |
+
punct_radio = gr.Radio(
|
109 |
+
label="Whether to add punctuation (Only for Chinese and English)",
|
110 |
+
choices=["Yes", "No"],
|
111 |
+
value="Yes",
|
112 |
+
)
|
113 |
+
|
114 |
uploaded_file = gr.Audio(
|
115 |
sources=["upload"],
|
116 |
type="filepath",
|