AshwinSankar commited on
Commit
073e6e9
Β·
1 Parent(s): c7ed412

fix gradio text

Browse files
Files changed (1) hide show
  1. app.py +14 -16
app.py CHANGED
@@ -1,18 +1,12 @@
1
  from __future__ import annotations
2
 
3
  import os
4
- import pathlib
5
- from typing import Any, Dict
6
 
7
  import gradio as gr
8
- import numpy as np
9
- import torch
10
 
11
- # from seamless_communication.inference import Translator
12
  import torchaudio
13
 
14
- # from fairseq2.assets import InProcAssetMetadataProvider, asset_store
15
- from huggingface_hub import snapshot_download
16
  from transformers import (
17
  SeamlessM4TFeatureExtractor,
18
  SeamlessM4TTokenizer,
@@ -25,19 +19,23 @@ from lang_list import (
25
  S2ST_TARGET_LANGUAGE_NAMES,
26
  S2TT_TARGET_LANGUAGE_NAMES,
27
  T2ST_TARGET_LANGUAGE_NAMES,
28
- # T2TT_TARGET_LANGUAGE_NAMES,
29
  TEXT_SOURCE_LANGUAGE_NAMES,
30
  )
31
 
32
 
33
  DESCRIPTION = """\
34
- # SeamlessM4T
 
 
 
 
35
 
36
- [SeamlessM4T](https://github.com/facebookresearch/seamless_communication) is designed to provide high-quality
37
- translation, allowing people from different linguistic communities to communicate effortlessly through speech and text.
38
- This unified model enables multiple tasks like Speech-to-Speech (S2ST), Speech-to-Text (S2TT), Text-to-Speech (T2ST)
39
- translation and more, without relying on multiple separate models. The model is also in use on the
40
- [SeamlessM4T demo website](https://seamless.metademolab.com/m4t?utm_source=huggingface&utm_medium=web&utm_campaign=seamless&utm_content=m4tspace).
 
41
  """
42
 
43
  hf_token = os.getenv("HF_TOKEN")
@@ -206,9 +204,9 @@ with gr.Blocks() as demo_asr:
206
  choices=ASR_TARGET_LANGUAGE_NAMES,
207
  value=DEFAULT_TARGET_LANGUAGE,
208
  )
209
- btn = gr.Button("Translate")
210
  with gr.Column():
211
- output_text = gr.Textbox(label="Translated text")
212
 
213
  gr.Examples(
214
  examples=[
 
1
  from __future__ import annotations
2
 
3
  import os
 
 
4
 
5
  import gradio as gr
 
 
6
 
7
+ import torch
8
  import torchaudio
9
 
 
 
10
  from transformers import (
11
  SeamlessM4TFeatureExtractor,
12
  SeamlessM4TTokenizer,
 
19
  S2ST_TARGET_LANGUAGE_NAMES,
20
  S2TT_TARGET_LANGUAGE_NAMES,
21
  T2ST_TARGET_LANGUAGE_NAMES,
 
22
  TEXT_SOURCE_LANGUAGE_NAMES,
23
  )
24
 
25
 
26
  DESCRIPTION = """\
27
+ ### **IndicSeamlessM4T: Speech-to-Text Translation for Indian Languages** πŸŽ™οΈβž‘οΈπŸ“œ
28
+
29
+ This Gradio demo showcases **IndicSeamlessM4T**, a fine-tuned **SeamlessM4T** model for **speech-to-text translation** across **13 Indian languages and English**. Trained on **BhasaAnuvaad**, the largest open-source speech translation dataset for Indian languages, it delivers **accurate and robust translations** across diverse linguistic and acoustic conditions.
30
+
31
+ πŸ”— **Model Checkpoint:** [ai4bharat/seamless-m4t-v2-large-stt](https://huggingface.co/ai4bharat/seamless-m4t-v2-large-stt)
32
 
33
+ #### **How to Use:**
34
+ 1. **Upload or record** an audio clip in any supported Indian language.
35
+ 2. Click **"Translate"** to generate the corresponding text in the target language.
36
+ 3. View or copy the output for further use.
37
+
38
+ πŸš€ Try it out and experience seamless speech translation for Indian languages!
39
  """
40
 
41
  hf_token = os.getenv("HF_TOKEN")
 
204
  choices=ASR_TARGET_LANGUAGE_NAMES,
205
  value=DEFAULT_TARGET_LANGUAGE,
206
  )
207
+ btn = gr.Button("Transcribe")
208
  with gr.Column():
209
+ output_text = gr.Textbox(label="Transcribed text")
210
 
211
  gr.Examples(
212
  examples=[