Spaces:
Runtime error
Runtime error
Rename app (2).py to app.py
Browse files- app (2).py → app.py +8 -25
app (2).py → app.py
RENAMED
|
@@ -45,10 +45,9 @@ This Gradio demo showcases **IndicConformer**, a speech recognition model for **
|
|
| 45 |
#### **How to Use:**
|
| 46 |
1. **Upload or record** an audio clip in any supported Indian language.
|
| 47 |
2. Select the **mode** (CTC or RNNT) for transcription.
|
| 48 |
-
3. Click **"Transcribe"** to generate the corresponding text
|
| 49 |
4. View or copy the output for further use.
|
| 50 |
|
| 51 |
-
🚀 Try it out and experience seamless speech recognition for Indian languages!
|
| 52 |
"""
|
| 53 |
|
| 54 |
hf_token = os.getenv("HF_TOKEN")
|
|
@@ -62,8 +61,8 @@ model.eval()
|
|
| 62 |
CACHE_EXAMPLES = os.getenv("CACHE_EXAMPLES") == "1" and torch.cuda.is_available()
|
| 63 |
|
| 64 |
AUDIO_SAMPLE_RATE = 16000
|
| 65 |
-
MAX_INPUT_AUDIO_LENGTH =
|
| 66 |
-
DEFAULT_TARGET_LANGUAGE = "
|
| 67 |
|
| 68 |
@spaces.GPU
|
| 69 |
def run_asr_ctc(input_audio: str, target_language: str) -> str:
|
|
@@ -156,14 +155,6 @@ with gr.Blocks() as demo_asr_ctc:
|
|
| 156 |
btn = gr.Button("Transcribe")
|
| 157 |
with gr.Column():
|
| 158 |
output_text = gr.Textbox(label="Transcribed text")
|
| 159 |
-
|
| 160 |
-
gr.Examples(
|
| 161 |
-
examples=[
|
| 162 |
-
["assets/Bengali.wav", "Bengali", "English"],
|
| 163 |
-
["assets/Gujarati.wav", "Gujarati", "Hindi"],
|
| 164 |
-
["assets/Punjabi.wav", "Punjabi", "Hindi"],
|
| 165 |
-
|
| 166 |
-
],
|
| 167 |
inputs=[input_audio, target_language],
|
| 168 |
outputs=output_text,
|
| 169 |
fn=run_asr_ctc,
|
|
@@ -191,14 +182,6 @@ with gr.Blocks() as demo_asr_rnnt:
|
|
| 191 |
btn = gr.Button("Transcribe")
|
| 192 |
with gr.Column():
|
| 193 |
output_text = gr.Textbox(label="Transcribed text")
|
| 194 |
-
|
| 195 |
-
gr.Examples(
|
| 196 |
-
examples=[
|
| 197 |
-
["assets/Bengali.wav", "Bengali", "English"],
|
| 198 |
-
["assets/Gujarati.wav", "Gujarati", "Hindi"],
|
| 199 |
-
["assets/Punjabi.wav", "Punjabi", "Hindi"],
|
| 200 |
-
|
| 201 |
-
],
|
| 202 |
inputs=[input_audio, target_language],
|
| 203 |
outputs=output_text,
|
| 204 |
fn=run_asr_rnnt,
|
|
@@ -216,11 +199,11 @@ with gr.Blocks() as demo_asr_rnnt:
|
|
| 216 |
|
| 217 |
with gr.Blocks(css="style.css") as demo:
|
| 218 |
gr.Markdown(DESCRIPTION)
|
| 219 |
-
gr.DuplicateButton(
|
| 220 |
-
value="Duplicate Space for private use",
|
| 221 |
-
elem_id="duplicate-button",
|
| 222 |
-
visible=os.getenv("SHOW_DUPLICATE_BUTTON") == "1",
|
| 223 |
-
)
|
| 224 |
|
| 225 |
with gr.Tabs():
|
| 226 |
with gr.Tab(label="CTC"):
|
|
|
|
| 45 |
#### **How to Use:**
|
| 46 |
1. **Upload or record** an audio clip in any supported Indian language.
|
| 47 |
2. Select the **mode** (CTC or RNNT) for transcription.
|
| 48 |
+
3. Click **"Transcribe"** to generate the corresponding text.
|
| 49 |
4. View or copy the output for further use.
|
| 50 |
|
|
|
|
| 51 |
"""
|
| 52 |
|
| 53 |
hf_token = os.getenv("HF_TOKEN")
|
|
|
|
| 61 |
CACHE_EXAMPLES = os.getenv("CACHE_EXAMPLES") == "1" and torch.cuda.is_available()
|
| 62 |
|
| 63 |
AUDIO_SAMPLE_RATE = 16000
|
| 64 |
+
MAX_INPUT_AUDIO_LENGTH = 600 # in seconds
|
| 65 |
+
DEFAULT_TARGET_LANGUAGE = "Hindi"
|
| 66 |
|
| 67 |
@spaces.GPU
|
| 68 |
def run_asr_ctc(input_audio: str, target_language: str) -> str:
|
|
|
|
| 155 |
btn = gr.Button("Transcribe")
|
| 156 |
with gr.Column():
|
| 157 |
output_text = gr.Textbox(label="Transcribed text")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 158 |
inputs=[input_audio, target_language],
|
| 159 |
outputs=output_text,
|
| 160 |
fn=run_asr_ctc,
|
|
|
|
| 182 |
btn = gr.Button("Transcribe")
|
| 183 |
with gr.Column():
|
| 184 |
output_text = gr.Textbox(label="Transcribed text")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 185 |
inputs=[input_audio, target_language],
|
| 186 |
outputs=output_text,
|
| 187 |
fn=run_asr_rnnt,
|
|
|
|
| 199 |
|
| 200 |
with gr.Blocks(css="style.css") as demo:
|
| 201 |
gr.Markdown(DESCRIPTION)
|
| 202 |
+
# gr.DuplicateButton(
|
| 203 |
+
# value="Duplicate Space for private use",
|
| 204 |
+
# elem_id="duplicate-button",
|
| 205 |
+
# visible=os.getenv("SHOW_DUPLICATE_BUTTON") == "1",
|
| 206 |
+
# )
|
| 207 |
|
| 208 |
with gr.Tabs():
|
| 209 |
with gr.Tab(label="CTC"):
|